24 Jul 2008
This commit is contained in:
parent
20bcfa9ece
commit
3c28d5b83a
|
@ -1,107 +0,0 @@
|
|||
const byte blank_frame[] =
|
||||
{
|
||||
0x42, 0x4d, 0x76, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36,
|
||||
0x04, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80,
|
||||
0x00, 0x80, 0x80, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0x00, 0xc0, 0xdc,
|
||||
0xc0, 0x00, 0xf0, 0xca, 0xa6, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00,
|
||||
0x20, 0x60, 0x00, 0x00, 0x20, 0x80, 0x00, 0x00, 0x20, 0xa0, 0x00,
|
||||
0x00, 0x20, 0xc0, 0x00, 0x00, 0x20, 0xe0, 0x00, 0x00, 0x40, 0x00,
|
||||
0x00, 0x00, 0x40, 0x20, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40,
|
||||
0x60, 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x40, 0xa0, 0x00, 0x00,
|
||||
0x40, 0xc0, 0x00, 0x00, 0x40, 0xe0, 0x00, 0x00, 0x60, 0x00, 0x00,
|
||||
0x00, 0x60, 0x20, 0x00, 0x00, 0x60, 0x40, 0x00, 0x00, 0x60, 0x60,
|
||||
0x00, 0x00, 0x60, 0x80, 0x00, 0x00, 0x60, 0xa0, 0x00, 0x00, 0x60,
|
||||
0xc0, 0x00, 0x00, 0x60, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
|
||||
0x80, 0x20, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x60, 0x00,
|
||||
0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0xa0, 0x00, 0x00, 0x80, 0xc0,
|
||||
0x00, 0x00, 0x80, 0xe0, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa0,
|
||||
0x20, 0x00, 0x00, 0xa0, 0x40, 0x00, 0x00, 0xa0, 0x60, 0x00, 0x00,
|
||||
0xa0, 0x80, 0x00, 0x00, 0xa0, 0xa0, 0x00, 0x00, 0xa0, 0xc0, 0x00,
|
||||
0x00, 0xa0, 0xe0, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x20,
|
||||
0x00, 0x00, 0xc0, 0x40, 0x00, 0x00, 0xc0, 0x60, 0x00, 0x00, 0xc0,
|
||||
0x80, 0x00, 0x00, 0xc0, 0xa0, 0x00, 0x00, 0xc0, 0xc0, 0x00, 0x00,
|
||||
0xc0, 0xe0, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0x20, 0x00,
|
||||
0x00, 0xe0, 0x40, 0x00, 0x00, 0xe0, 0x60, 0x00, 0x00, 0xe0, 0x80,
|
||||
0x00, 0x00, 0xe0, 0xa0, 0x00, 0x00, 0xe0, 0xc0, 0x00, 0x00, 0xe0,
|
||||
0xe0, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x40,
|
||||
0x00, 0x40, 0x00, 0x40, 0x00, 0x60, 0x00, 0x40, 0x00, 0x80, 0x00,
|
||||
0x40, 0x00, 0xa0, 0x00, 0x40, 0x00, 0xc0, 0x00, 0x40, 0x00, 0xe0,
|
||||
0x00, 0x40, 0x20, 0x00, 0x00, 0x40, 0x20, 0x20, 0x00, 0x40, 0x20,
|
||||
0x40, 0x00, 0x40, 0x20, 0x60, 0x00, 0x40, 0x20, 0x80, 0x00, 0x40,
|
||||
0x20, 0xa0, 0x00, 0x40, 0x20, 0xc0, 0x00, 0x40, 0x20, 0xe0, 0x00,
|
||||
0x40, 0x40, 0x00, 0x00, 0x40, 0x40, 0x20, 0x00, 0x40, 0x40, 0x40,
|
||||
0x00, 0x40, 0x40, 0x60, 0x00, 0x40, 0x40, 0x80, 0x00, 0x40, 0x40,
|
||||
0xa0, 0x00, 0x40, 0x40, 0xc0, 0x00, 0x40, 0x40, 0xe0, 0x00, 0x40,
|
||||
0x60, 0x00, 0x00, 0x40, 0x60, 0x20, 0x00, 0x40, 0x60, 0x40, 0x00,
|
||||
0x40, 0x60, 0x60, 0x00, 0x40, 0x60, 0x80, 0x00, 0x40, 0x60, 0xa0,
|
||||
0x00, 0x40, 0x60, 0xc0, 0x00, 0x40, 0x60, 0xe0, 0x00, 0x40, 0x80,
|
||||
0x00, 0x00, 0x40, 0x80, 0x20, 0x00, 0x40, 0x80, 0x40, 0x00, 0x40,
|
||||
0x80, 0x60, 0x00, 0x40, 0x80, 0x80, 0x00, 0x40, 0x80, 0xa0, 0x00,
|
||||
0x40, 0x80, 0xc0, 0x00, 0x40, 0x80, 0xe0, 0x00, 0x40, 0xa0, 0x00,
|
||||
0x00, 0x40, 0xa0, 0x20, 0x00, 0x40, 0xa0, 0x40, 0x00, 0x40, 0xa0,
|
||||
0x60, 0x00, 0x40, 0xa0, 0x80, 0x00, 0x40, 0xa0, 0xa0, 0x00, 0x40,
|
||||
0xa0, 0xc0, 0x00, 0x40, 0xa0, 0xe0, 0x00, 0x40, 0xc0, 0x00, 0x00,
|
||||
0x40, 0xc0, 0x20, 0x00, 0x40, 0xc0, 0x40, 0x00, 0x40, 0xc0, 0x60,
|
||||
0x00, 0x40, 0xc0, 0x80, 0x00, 0x40, 0xc0, 0xa0, 0x00, 0x40, 0xc0,
|
||||
0xc0, 0x00, 0x40, 0xc0, 0xe0, 0x00, 0x40, 0xe0, 0x00, 0x00, 0x40,
|
||||
0xe0, 0x20, 0x00, 0x40, 0xe0, 0x40, 0x00, 0x40, 0xe0, 0x60, 0x00,
|
||||
0x40, 0xe0, 0x80, 0x00, 0x40, 0xe0, 0xa0, 0x00, 0x40, 0xe0, 0xc0,
|
||||
0x00, 0x40, 0xe0, 0xe0, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00,
|
||||
0x20, 0x00, 0x80, 0x00, 0x40, 0x00, 0x80, 0x00, 0x60, 0x00, 0x80,
|
||||
0x00, 0x80, 0x00, 0x80, 0x00, 0xa0, 0x00, 0x80, 0x00, 0xc0, 0x00,
|
||||
0x80, 0x00, 0xe0, 0x00, 0x80, 0x20, 0x00, 0x00, 0x80, 0x20, 0x20,
|
||||
0x00, 0x80, 0x20, 0x40, 0x00, 0x80, 0x20, 0x60, 0x00, 0x80, 0x20,
|
||||
0x80, 0x00, 0x80, 0x20, 0xa0, 0x00, 0x80, 0x20, 0xc0, 0x00, 0x80,
|
||||
0x20, 0xe0, 0x00, 0x80, 0x40, 0x00, 0x00, 0x80, 0x40, 0x20, 0x00,
|
||||
0x80, 0x40, 0x40, 0x00, 0x80, 0x40, 0x60, 0x00, 0x80, 0x40, 0x80,
|
||||
0x00, 0x80, 0x40, 0xa0, 0x00, 0x80, 0x40, 0xc0, 0x00, 0x80, 0x40,
|
||||
0xe0, 0x00, 0x80, 0x60, 0x00, 0x00, 0x80, 0x60, 0x20, 0x00, 0x80,
|
||||
0x60, 0x40, 0x00, 0x80, 0x60, 0x60, 0x00, 0x80, 0x60, 0x80, 0x00,
|
||||
0x80, 0x60, 0xa0, 0x00, 0x80, 0x60, 0xc0, 0x00, 0x80, 0x60, 0xe0,
|
||||
0x00, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x20, 0x00, 0x80, 0x80,
|
||||
0x40, 0x00, 0x80, 0x80, 0x60, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80,
|
||||
0x80, 0xa0, 0x00, 0x80, 0x80, 0xc0, 0x00, 0x80, 0x80, 0xe0, 0x00,
|
||||
0x80, 0xa0, 0x00, 0x00, 0x80, 0xa0, 0x20, 0x00, 0x80, 0xa0, 0x40,
|
||||
0x00, 0x80, 0xa0, 0x60, 0x00, 0x80, 0xa0, 0x80, 0x00, 0x80, 0xa0,
|
||||
0xa0, 0x00, 0x80, 0xa0, 0xc0, 0x00, 0x80, 0xa0, 0xe0, 0x00, 0x80,
|
||||
0xc0, 0x00, 0x00, 0x80, 0xc0, 0x20, 0x00, 0x80, 0xc0, 0x40, 0x00,
|
||||
0x80, 0xc0, 0x60, 0x00, 0x80, 0xc0, 0x80, 0x00, 0x80, 0xc0, 0xa0,
|
||||
0x00, 0x80, 0xc0, 0xc0, 0x00, 0x80, 0xc0, 0xe0, 0x00, 0x80, 0xe0,
|
||||
0x00, 0x00, 0x80, 0xe0, 0x20, 0x00, 0x80, 0xe0, 0x40, 0x00, 0x80,
|
||||
0xe0, 0x60, 0x00, 0x80, 0xe0, 0x80, 0x00, 0x80, 0xe0, 0xa0, 0x00,
|
||||
0x80, 0xe0, 0xc0, 0x00, 0x80, 0xe0, 0xe0, 0x00, 0xc0, 0x00, 0x00,
|
||||
0x00, 0xc0, 0x00, 0x20, 0x00, 0xc0, 0x00, 0x40, 0x00, 0xc0, 0x00,
|
||||
0x60, 0x00, 0xc0, 0x00, 0x80, 0x00, 0xc0, 0x00, 0xa0, 0x00, 0xc0,
|
||||
0x00, 0xc0, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xc0, 0x20, 0x00, 0x00,
|
||||
0xc0, 0x20, 0x20, 0x00, 0xc0, 0x20, 0x40, 0x00, 0xc0, 0x20, 0x60,
|
||||
0x00, 0xc0, 0x20, 0x80, 0x00, 0xc0, 0x20, 0xa0, 0x00, 0xc0, 0x20,
|
||||
0xc0, 0x00, 0xc0, 0x20, 0xe0, 0x00, 0xc0, 0x40, 0x00, 0x00, 0xc0,
|
||||
0x40, 0x20, 0x00, 0xc0, 0x40, 0x40, 0x00, 0xc0, 0x40, 0x60, 0x00,
|
||||
0xc0, 0x40, 0x80, 0x00, 0xc0, 0x40, 0xa0, 0x00, 0xc0, 0x40, 0xc0,
|
||||
0x00, 0xc0, 0x40, 0xe0, 0x00, 0xc0, 0x60, 0x00, 0x00, 0xc0, 0x60,
|
||||
0x20, 0x00, 0xc0, 0x60, 0x40, 0x00, 0xc0, 0x60, 0x60, 0x00, 0xc0,
|
||||
0x60, 0x80, 0x00, 0xc0, 0x60, 0xa0, 0x00, 0xc0, 0x60, 0xc0, 0x00,
|
||||
0xc0, 0x60, 0xe0, 0x00, 0xc0, 0x80, 0x00, 0x00, 0xc0, 0x80, 0x20,
|
||||
0x00, 0xc0, 0x80, 0x40, 0x00, 0xc0, 0x80, 0x60, 0x00, 0xc0, 0x80,
|
||||
0x80, 0x00, 0xc0, 0x80, 0xa0, 0x00, 0xc0, 0x80, 0xc0, 0x00, 0xc0,
|
||||
0x80, 0xe0, 0x00, 0xc0, 0xa0, 0x00, 0x00, 0xc0, 0xa0, 0x20, 0x00,
|
||||
0xc0, 0xa0, 0x40, 0x00, 0xc0, 0xa0, 0x60, 0x00, 0xc0, 0xa0, 0x80,
|
||||
0x00, 0xc0, 0xa0, 0xa0, 0x00, 0xc0, 0xa0, 0xc0, 0x00, 0xc0, 0xa0,
|
||||
0xe0, 0x00, 0xc0, 0xc0, 0x00, 0x00, 0xc0, 0xc0, 0x20, 0x00, 0xc0,
|
||||
0xc0, 0x40, 0x00, 0xc0, 0xc0, 0x60, 0x00, 0xc0, 0xc0, 0x80, 0x00,
|
||||
0xc0, 0xc0, 0xa0, 0x00, 0xf0, 0xfb, 0xff, 0x00, 0xa4, 0xa0, 0xa0,
|
||||
0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
|
||||
0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
|
||||
0x00, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00,
|
||||
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
|
||||
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07
|
||||
};
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "bsplib.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
void GetLeafNums (void);
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#define BSPLIB_H
|
||||
|
||||
#include "platform.h"
|
||||
#include "basefiles.h"
|
||||
#include "utils.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ void TriEdge_r (triangulation_t *trian, triedge_t *e)
|
|||
// find the point with the best angle
|
||||
p0 = trian->points[e->p0]->origin;
|
||||
p1 = trian->points[e->p1]->origin;
|
||||
best = 1.1;
|
||||
best = 1.1f;
|
||||
for (i=0 ; i< trian->numpoints ; i++)
|
||||
{
|
||||
p = trian->points[i]->origin;
|
||||
|
|
|
@ -368,7 +368,7 @@ void MakeNodePortal (node_t *node)
|
|||
else
|
||||
Sys_Error ("CutNodePortals_r: mislinked portal");
|
||||
|
||||
ChopWindingInPlace (&w, normal, dist, 0.1);
|
||||
ChopWindingInPlace (&w, normal, dist, 0.1f);
|
||||
}
|
||||
|
||||
if (!w)
|
||||
|
|
|
@ -35,9 +35,9 @@ int junk;
|
|||
int numbounce = 3;
|
||||
float ambient = 0;
|
||||
float maxlight = 196;
|
||||
float lightscale = 1.0;
|
||||
float direct_scale = 0.4;
|
||||
float entity_scale = 1.0;
|
||||
float lightscale = 1.0f;
|
||||
float direct_scale = 0.4f;
|
||||
float entity_scale = 1.0f;
|
||||
|
||||
/*
|
||||
===================================================================
|
||||
|
@ -476,7 +476,7 @@ void WradMain ( bool option )
|
|||
{
|
||||
Msg ("No vis information, direct lighting only.\n");
|
||||
numbounce = 0;
|
||||
ambient = 0.1;
|
||||
ambient = 0.1f;
|
||||
}
|
||||
|
||||
RadWorld ();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
#include "bsplib.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
int nummiptex;
|
||||
extern int g_mapversion;
|
||||
|
|
|
@ -245,10 +245,6 @@ SOURCE=.\bsplib\writebsp.c
|
|||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\blankframe.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\bsplib\bsplib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -265,14 +261,6 @@ SOURCE=.\platform.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\public\ref_system.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\roqlib\roq_vq0.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\roqlib\roqlib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
vec3_t verts[3];
|
||||
}triangle_t;
|
||||
} triangle_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
aliaspoint_t pt[3];
|
||||
}tf_triangle;
|
||||
} tf_triangle;
|
||||
|
||||
extern int numseq;
|
||||
extern int numani;
|
||||
|
|
|
@ -9,10 +9,7 @@
|
|||
#include <setjmp.h>
|
||||
#include <windows.h>
|
||||
#include "basetypes.h"
|
||||
#include "stdapi.h"
|
||||
#include "stdref.h"
|
||||
#include "basefiles.h"
|
||||
#include "dllapi.h"
|
||||
#include "ref_dllapi.h"
|
||||
|
||||
//=====================================
|
||||
// platform export
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "roqlib.h"
|
||||
#include "byteorder.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
uint keyBits = 0;
|
||||
|
@ -305,8 +306,8 @@ static void ROQ_WriteHeader(file_t *file)
|
|||
roq_t hdr;
|
||||
|
||||
hdr.ident = IDQMOVIEHEADER;
|
||||
hdr.flags = 0xffff;
|
||||
hdr.flags2 = 0xffff;
|
||||
hdr.flags = (short)0xffff;
|
||||
hdr.flags2 = (short)0xffff;
|
||||
hdr.fps = frameRate;
|
||||
|
||||
FS_Write(file, &hdr, sizeof(roq_t));
|
||||
|
|
|
@ -8,6 +8,24 @@
|
|||
#include "platform.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
ROQ FILES
|
||||
|
||||
The .roq file are vector-compressed movies
|
||||
========================================================================
|
||||
*/
|
||||
#define IDQMOVIEHEADER 0x1084 // little-endian "„"
|
||||
|
||||
typedef struct roq_s
|
||||
{
|
||||
word ident;
|
||||
short flags;
|
||||
short flags2;
|
||||
word fps;
|
||||
} roq_t;
|
||||
|
||||
typedef struct { byte *rgb; } videoFrame_t;
|
||||
typedef struct { long x,y; } motionVector_t;
|
||||
typedef struct { byte yuv[6]; } yuvBlock2_t;
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "platform.h"
|
||||
#include "basefiles.h"
|
||||
#include "baseimages.h"
|
||||
#include "byteorder.h"
|
||||
#include "builtin.h"
|
||||
#include "utils.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
|
@ -38,28 +38,17 @@ WriteFrame
|
|||
*/
|
||||
void WriteFrame( file_t *f, int framenum )
|
||||
{
|
||||
dframe_t *pframe, frametemp;
|
||||
vfile_t *h = VFS_Open( f, "wz" );
|
||||
fs_offset_t hdrstart, bufstart, bufend;
|
||||
dframe_t *pframe;
|
||||
|
||||
pframe = (dframe_t *)frames[framenum].pdata;
|
||||
frametemp.origin[0] = LittleLong (pframe->origin[0]);
|
||||
frametemp.origin[1] = LittleLong (pframe->origin[1]);
|
||||
frametemp.width = LittleLong (pframe->width);
|
||||
frametemp.height = LittleLong (pframe->height);
|
||||
frametemp.compsize = 0; // unknown at this moment
|
||||
pframe->origin[0] = LittleLong( pframe->origin[0] );
|
||||
pframe->origin[1] = LittleLong( pframe->origin[1] );
|
||||
pframe->width = LittleLong (pframe->width);
|
||||
pframe->height = LittleLong (pframe->height);
|
||||
|
||||
hdrstart = FS_Tell(f);
|
||||
FS_Write(f, &frametemp, sizeof(frametemp));
|
||||
bufstart = FS_Tell(f);
|
||||
VFS_Write(h, (byte *)(pframe + 1), pframe->height * pframe->width * 4 );
|
||||
f = VFS_Close(h); // compress frame buffer
|
||||
bufend = FS_Tell(f);
|
||||
frametemp.compsize = bufend - bufstart; // size of compressed frame
|
||||
|
||||
FS_Seek(f, hdrstart, SEEK_SET );
|
||||
FS_Write(f, &frametemp, sizeof(frametemp)); // merge header
|
||||
FS_Seek(f, bufend, SEEK_SET ); // go to end of frame
|
||||
// write frame as normal 32-bit image
|
||||
FS_Write(f, pframe, sizeof(*pframe));
|
||||
FS_Write(f, (byte *)(pframe + 1), pframe->height * pframe->width * 4 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -175,6 +164,8 @@ void Cmd_Type( void )
|
|||
else if (Com_MatchToken( "vp_parallel" )) sprite.type = SPR_FWD_PARALLEL;
|
||||
else if (Com_MatchToken( "oriented" )) sprite.type = SPR_ORIENTED;
|
||||
else if (Com_MatchToken( "vp_parallel_oriented")) sprite.type = SPR_FWD_PARALLEL_ORIENTED;
|
||||
else if (Com_MatchToken( "label")) sprite.type = SPR_LABEL;
|
||||
else if (Com_MatchToken( "label_scaled")) sprite.type = SPR_LABEL_SCALE;
|
||||
else sprite.type = SPR_FWD_PARALLEL; // default
|
||||
}
|
||||
|
||||
|
@ -198,20 +189,19 @@ void Cmd_RenderMode( void )
|
|||
|
||||
/*
|
||||
==============
|
||||
Cmd_MoveType
|
||||
Cmd_FaceType
|
||||
|
||||
syntax: "$movetype"
|
||||
syntax: "$facetype"
|
||||
==============
|
||||
*/
|
||||
void Cmd_MoveType( void )
|
||||
void Cmd_FaceType( void )
|
||||
{
|
||||
Com_GetToken( false );
|
||||
|
||||
if (Com_MatchToken( "static")) sprite.movetype = SPR_STATIC;
|
||||
else if (Com_MatchToken( "bounce")) sprite.movetype = SPR_BOUNCE;
|
||||
else if (Com_MatchToken( "gravity")) sprite.movetype = SPR_GRAVITY;
|
||||
else if (Com_MatchToken( "fly")) sprite.movetype = SPR_FLYING;
|
||||
else sprite.movetype = SPR_STATIC; // default
|
||||
if (Com_MatchToken( "normal")) sprite.facetype = SPR_SINGLE_FACE;
|
||||
else if (Com_MatchToken( "twoside")) sprite.facetype = SPR_DOUBLE_FACE;
|
||||
else if (Com_MatchToken( "xcross")) sprite.facetype = SPR_XCROSS_FACE;
|
||||
else sprite.facetype = SPR_SINGLE_FACE; // default
|
||||
}
|
||||
|
||||
|
||||
|
@ -466,14 +456,14 @@ static void Cmd_Origin( void )
|
|||
|
||||
/*
|
||||
===============
|
||||
Cmd_Scale
|
||||
Cmd_Rand
|
||||
|
||||
syntax: $scale "value"
|
||||
syntax: $rand
|
||||
===============
|
||||
*/
|
||||
static void Cmd_Scale( void )
|
||||
static void Cmd_Rand( void )
|
||||
{
|
||||
sprite.scale = com.atof(Com_GetToken( false ));
|
||||
sprite.synctype = ST_RAND;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -506,8 +496,8 @@ void ResetSpriteInfo( void )
|
|||
sprite.ident = IDSPRITEHEADER;
|
||||
sprite.version = SPRITE_VERSION;
|
||||
sprite.type = SPR_FWD_PARALLEL;
|
||||
sprite.movetype = SPR_STATIC;
|
||||
sprite.scale = 1.0f;
|
||||
sprite.facetype = SPR_SINGLE_FACE;
|
||||
sprite.synctype = ST_SYNC;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -524,9 +514,9 @@ bool ParseSpriteScript (void)
|
|||
if(!Com_GetToken (true)) break;
|
||||
if (Com_MatchToken( "$spritename" )) Cmd_Spritename();
|
||||
else if (Com_MatchToken( "$render" )) Cmd_RenderMode();
|
||||
else if (Com_MatchToken( "$movetype" )) Cmd_MoveType();
|
||||
else if (Com_MatchToken( "$facetype" )) Cmd_FaceType();
|
||||
else if (Com_MatchToken( "$origin" )) Cmd_Origin();
|
||||
else if (Com_MatchToken( "$scale" )) Cmd_Scale();
|
||||
else if (Com_MatchToken( "$rand" )) Cmd_Rand();
|
||||
else if (Com_MatchToken( "$load" )) Cmd_Load();
|
||||
else if (Com_MatchToken( "$type" )) Cmd_Type();
|
||||
else if (Com_MatchToken( "$frame" ))
|
||||
|
|
|
@ -985,13 +985,13 @@ void SimplifyModel (void)
|
|||
|
||||
if (k < 3)
|
||||
{
|
||||
minv = -128.0;
|
||||
maxv = 128.0;
|
||||
minv = -128.0f;
|
||||
maxv = 128.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
minv = -M_PI / 8.0;
|
||||
maxv = M_PI / 8.0;
|
||||
minv = -M_PI / 8.0f;
|
||||
maxv = M_PI / 8.0f;
|
||||
}
|
||||
|
||||
for (i = 0; i < numseq; i++)
|
||||
|
@ -2454,7 +2454,7 @@ void ResetModelInfo( void )
|
|||
defaultzrotation = M_PI / 2;
|
||||
|
||||
numrep = 0;
|
||||
gamma = 1.8;
|
||||
gamma = 1.8f;
|
||||
flip_triangles = 1;
|
||||
normal_blend = cos( 2.0 * (M_PI / 180.0));
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "mdllib.h"
|
||||
|
||||
typedef struct { int type; char *name; } activity_map_t; // studio activity map conversion
|
||||
int used[MAXSTUDIOTRIANGLES]; // the command list holds counts and s/t values
|
||||
short commands[MAXSTUDIOTRIANGLES * 13]; //that are valid for every frame
|
||||
int stripverts[MAXSTUDIOTRIANGLES+2];
|
||||
|
@ -13,6 +13,220 @@ int neighbortri[MAXSTUDIOTRIANGLES][3];
|
|||
int neighboredge[MAXSTUDIOTRIANGLES][3];
|
||||
s_trianglevert_t (*triangles)[3];
|
||||
|
||||
enum ai_activity
|
||||
{
|
||||
ACT_RESET = 0, // Set m_Activity to this invalid value to force a reset to m_IdealActivity
|
||||
ACT_IDLE = 1,
|
||||
ACT_GUARD,
|
||||
ACT_WALK,
|
||||
ACT_RUN,
|
||||
ACT_FLY, // Fly (and flap if appropriate)
|
||||
ACT_SWIM,
|
||||
ACT_HOP, // vertical jump
|
||||
ACT_LEAP, // long forward jump
|
||||
ACT_FALL,
|
||||
ACT_LAND,
|
||||
ACT_STRAFE_LEFT,
|
||||
ACT_STRAFE_RIGHT,
|
||||
ACT_ROLL_LEFT, // tuck and roll, left
|
||||
ACT_ROLL_RIGHT, // tuck and roll, right
|
||||
ACT_TURN_LEFT, // turn quickly left (stationary)
|
||||
ACT_TURN_RIGHT, // turn quickly right (stationary)
|
||||
ACT_CROUCH, // the act of crouching down from a standing position
|
||||
ACT_CROUCHIDLE, // holding body in crouched position (loops)
|
||||
ACT_STAND, // the act of standing from a crouched position
|
||||
ACT_USE,
|
||||
ACT_SIGNAL1,
|
||||
ACT_SIGNAL2,
|
||||
ACT_SIGNAL3,
|
||||
ACT_TWITCH,
|
||||
ACT_COWER,
|
||||
ACT_SMALL_FLINCH,
|
||||
ACT_BIG_FLINCH,
|
||||
ACT_RANGE_ATTACK1,
|
||||
ACT_RANGE_ATTACK2,
|
||||
ACT_MELEE_ATTACK1,
|
||||
ACT_MELEE_ATTACK2,
|
||||
ACT_RELOAD,
|
||||
ACT_ARM, // pull out gun, for instance
|
||||
ACT_DISARM, // reholster gun
|
||||
ACT_EAT, // monster chowing on a large food item (loop)
|
||||
ACT_DIESIMPLE,
|
||||
ACT_DIEBACKWARD,
|
||||
ACT_DIEFORWARD,
|
||||
ACT_DIEVIOLENT,
|
||||
ACT_BARNACLE_HIT, // barnacle tongue hits a monster
|
||||
ACT_BARNACLE_PULL, // barnacle is lifting the monster ( loop )
|
||||
ACT_BARNACLE_CHOMP, // barnacle latches on to the monster
|
||||
ACT_BARNACLE_CHEW, // barnacle is holding the monster in its mouth ( loop )
|
||||
ACT_SLEEP,
|
||||
ACT_INSPECT_FLOOR, // for active idles, look at something on or near the floor
|
||||
ACT_INSPECT_WALL, // for active idles, look at something directly ahead of you
|
||||
ACT_IDLE_ANGRY, // alternate idle animation in which the monster is clearly agitated. (loop)
|
||||
ACT_WALK_HURT, // limp (loop)
|
||||
ACT_RUN_HURT, // limp (loop)
|
||||
ACT_HOVER, // Idle while in flight
|
||||
ACT_GLIDE, // Fly (don't flap)
|
||||
ACT_FLY_LEFT, // Turn left in flight
|
||||
ACT_FLY_RIGHT, // Turn right in flight
|
||||
ACT_DETECT_SCENT, // this means the monster smells a scent carried by the air
|
||||
ACT_SNIFF, // this is the act of actually sniffing an item in front of the monster
|
||||
ACT_BITE, // some large monsters can eat small things in one bite. This plays one time, EAT loops.
|
||||
ACT_THREAT_DISPLAY, // without attacking, monster demonstrates that it is angry. (Yell, stick out chest, etc )
|
||||
ACT_FEAR_DISPLAY, // monster just saw something that it is afraid of
|
||||
ACT_EXCITED, // for some reason, monster is excited. Sees something he really likes to eat, or whatever
|
||||
ACT_SPECIAL_ATTACK1,// very monster specific special attacks.
|
||||
ACT_SPECIAL_ATTACK2,
|
||||
ACT_COMBAT_IDLE, // agitated idle.
|
||||
ACT_WALK_SCARED,
|
||||
ACT_RUN_SCARED,
|
||||
ACT_VICTORY_DANCE, // killed a player, do a victory dance.
|
||||
ACT_DIE_HEADSHOT, // die, hit in head.
|
||||
ACT_DIE_CHESTSHOT, // die, hit in chest
|
||||
ACT_DIE_GUTSHOT, // die, hit in gut
|
||||
ACT_DIE_BACKSHOT, // die, hit in back
|
||||
ACT_FLINCH_HEAD,
|
||||
ACT_FLINCH_CHEST,
|
||||
ACT_FLINCH_STOMACH,
|
||||
ACT_FLINCH_LEFTARM,
|
||||
ACT_FLINCH_RIGHTARM,
|
||||
ACT_FLINCH_LEFTLEG,
|
||||
ACT_FLINCH_RIGHTLEG,
|
||||
ACT_VM_NONE, // weapon viewmodel animations
|
||||
ACT_VM_DEPLOY, // deploy
|
||||
ACT_VM_DEPLOY_EMPTY,// deploy empty weapon
|
||||
ACT_VM_HOLSTER, // holster empty weapon
|
||||
ACT_VM_HOLSTER_EMPTY,
|
||||
ACT_VM_IDLE1,
|
||||
ACT_VM_IDLE2,
|
||||
ACT_VM_IDLE3,
|
||||
ACT_VM_RANGE_ATTACK1,
|
||||
ACT_VM_RANGE_ATTACK2,
|
||||
ACT_VM_RANGE_ATTACK3,
|
||||
ACT_VM_MELEE_ATTACK1,
|
||||
ACT_VM_MELEE_ATTACK2,
|
||||
ACT_VM_MELEE_ATTACK3,
|
||||
ACT_VM_SHOOT_EMPTY,
|
||||
ACT_VM_START_RELOAD,
|
||||
ACT_VM_RELOAD,
|
||||
ACT_VM_RELOAD_EMPTY,
|
||||
ACT_VM_TURNON,
|
||||
ACT_VM_TURNOFF,
|
||||
ACT_VM_PUMP, // pumping gun
|
||||
ACT_VM_PUMP_EMPTY,
|
||||
ACT_VM_START_CHARGE,
|
||||
ACT_VM_CHARGE,
|
||||
ACT_VM_OVERLOAD,
|
||||
ACT_VM_IDLE_EMPTY,
|
||||
};
|
||||
|
||||
static activity_map_t activity_map[] =
|
||||
{
|
||||
{ACT_IDLE, "ACT_IDLE" },
|
||||
{ACT_GUARD, "ACT_GUARD" },
|
||||
{ACT_WALK, "ACT_WALK" },
|
||||
{ACT_RUN, "ACT_RUN" },
|
||||
{ACT_FLY, "ACT_FLY" },
|
||||
{ACT_SWIM, "ACT_SWIM", },
|
||||
{ACT_HOP, "ACT_HOP", },
|
||||
{ACT_LEAP, "ACT_LEAP" },
|
||||
{ACT_FALL, "ACT_FALL" },
|
||||
{ACT_LAND, "ACT_LAND" },
|
||||
{ACT_STRAFE_LEFT, "ACT_STRAFE_LEFT" },
|
||||
{ACT_STRAFE_RIGHT, "ACT_STRAFE_RIGHT" },
|
||||
{ACT_ROLL_LEFT, "ACT_ROLL_LEFT" },
|
||||
{ACT_ROLL_RIGHT, "ACT_ROLL_RIGHT" },
|
||||
{ACT_TURN_LEFT, "ACT_TURN_LEFT" },
|
||||
{ACT_TURN_RIGHT, "ACT_TURN_RIGHT" },
|
||||
{ACT_CROUCH, "ACT_CROUCH" },
|
||||
{ACT_CROUCHIDLE, "ACT_CROUCHIDLE" },
|
||||
{ACT_STAND, "ACT_STAND" },
|
||||
{ACT_USE, "ACT_USE" },
|
||||
{ACT_SIGNAL1, "ACT_SIGNAL1" },
|
||||
{ACT_SIGNAL2, "ACT_SIGNAL2" },
|
||||
{ACT_SIGNAL3, "ACT_SIGNAL3" },
|
||||
{ACT_TWITCH, "ACT_TWITCH" },
|
||||
{ACT_COWER, "ACT_COWER" },
|
||||
{ACT_SMALL_FLINCH, "ACT_SMALL_FLINCH" },
|
||||
{ACT_BIG_FLINCH, "ACT_BIG_FLINCH" },
|
||||
{ACT_RANGE_ATTACK1, "ACT_RANGE_ATTACK1" },
|
||||
{ACT_RANGE_ATTACK2, "ACT_RANGE_ATTACK2" },
|
||||
{ACT_MELEE_ATTACK1, "ACT_MELEE_ATTACK1" },
|
||||
{ACT_MELEE_ATTACK2, "ACT_MELEE_ATTACK2" },
|
||||
{ACT_RELOAD, "ACT_RELOAD" },
|
||||
{ACT_ARM, "ACT_ARM" },
|
||||
{ACT_DISARM, "ACT_DISARM" },
|
||||
{ACT_EAT, "ACT_EAT" },
|
||||
{ACT_DIESIMPLE, "ACT_DIESIMPLE" },
|
||||
{ACT_DIEBACKWARD, "ACT_DIEBACKWARD" },
|
||||
{ACT_DIEFORWARD, "ACT_DIEFORWARD" },
|
||||
{ACT_DIEVIOLENT, "ACT_DIEVIOLENT" },
|
||||
{ACT_BARNACLE_HIT, "ACT_BARNACLE_HIT" },
|
||||
{ACT_BARNACLE_PULL, "ACT_BARNACLE_PULL" },
|
||||
{ACT_BARNACLE_CHOMP, "ACT_BARNACLE_CHOMP" },
|
||||
{ACT_BARNACLE_CHEW, "ACT_BARNACLE_CHEW" },
|
||||
{ACT_SLEEP, "ACT_SLEEP" },
|
||||
{ACT_INSPECT_FLOOR, "ACT_INSPECT_FLOOR" },
|
||||
{ACT_INSPECT_WALL, "ACT_INSPECT_WALL" },
|
||||
{ACT_IDLE_ANGRY, "ACT_IDLE_ANGRY" },
|
||||
{ACT_WALK_HURT, "ACT_WALK_HURT" },
|
||||
{ACT_RUN_HURT, "ACT_RUN_HURT" },
|
||||
{ACT_HOVER, "ACT_HOVER" },
|
||||
{ACT_GLIDE, "ACT_GLIDE" },
|
||||
{ACT_FLY_LEFT, "ACT_FLY_LEFT" },
|
||||
{ACT_FLY_RIGHT, "ACT_FLY_RIGHT" },
|
||||
{ACT_DETECT_SCENT, "ACT_DETECT_SCENT" },
|
||||
{ACT_SNIFF, "ACT_SNIFF" },
|
||||
{ACT_BITE, "ACT_BITE" },
|
||||
{ACT_THREAT_DISPLAY, "ACT_THREAT_DISPLAY" },
|
||||
{ACT_FEAR_DISPLAY, "ACT_FEAR_DISPLAY" },
|
||||
{ACT_EXCITED, "ACT_EXCITED" },
|
||||
{ACT_SPECIAL_ATTACK1, "ACT_SPECIAL_ATTACK1" },
|
||||
{ACT_SPECIAL_ATTACK2, "ACT_SPECIAL_ATTACK2" },
|
||||
{ACT_COMBAT_IDLE, "ACT_COMBAT_IDLE" },
|
||||
{ACT_WALK_SCARED, "ACT_WALK_SCARED" },
|
||||
{ACT_RUN_SCARED, "ACT_RUN_SCARED" },
|
||||
{ACT_VICTORY_DANCE, "ACT_VICTORY_DANCE" },
|
||||
{ACT_DIE_HEADSHOT, "ACT_DIE_HEADSHOT" },
|
||||
{ACT_DIE_CHESTSHOT, "ACT_DIE_CHESTSHOT" },
|
||||
{ACT_DIE_GUTSHOT, "ACT_DIE_GUTSHOT" },
|
||||
{ACT_DIE_BACKSHOT, "ACT_DIE_BACKSHOT" },
|
||||
{ACT_FLINCH_HEAD, "ACT_FLINCH_HEAD" },
|
||||
{ACT_FLINCH_CHEST, "ACT_FLINCH_CHEST" },
|
||||
{ACT_FLINCH_STOMACH, "ACT_FLINCH_STOMACH" },
|
||||
{ACT_FLINCH_LEFTARM, "ACT_FLINCH_LEFTARM" },
|
||||
{ACT_FLINCH_RIGHTARM, "ACT_FLINCH_RIGHTARM" },
|
||||
{ACT_FLINCH_LEFTLEG, "ACT_FLINCH_LEFTLEG" },
|
||||
{ACT_FLINCH_RIGHTLEG, "ACT_FLINCH_RIGHTLEG" },
|
||||
{ACT_VM_NONE, "ACT_VM_NONE" }, // invalid animation
|
||||
{ACT_VM_DEPLOY, "ACT_VM_DEPLOY" }, // deploy
|
||||
{ACT_VM_DEPLOY_EMPTY, "ACT_VM_DEPLOY_EMPTY" }, // deploy empty weapon
|
||||
{ACT_VM_HOLSTER, "ACT_VM_HOLSTER" }, // holster empty weapon
|
||||
{ACT_VM_HOLSTER_EMPTY, "ACT_VM_HOLSTER_EMPTY" },
|
||||
{ACT_VM_IDLE1, "ACT_VM_IDLE1" },
|
||||
{ACT_VM_IDLE2, "ACT_VM_IDLE2" },
|
||||
{ACT_VM_IDLE3, "ACT_VM_IDLE3" },
|
||||
{ACT_VM_RANGE_ATTACK1, "ACT_VM_RANGE_ATTACK1" },
|
||||
{ACT_VM_RANGE_ATTACK2, "ACT_VM_RANGE_ATTACK2" },
|
||||
{ACT_VM_RANGE_ATTACK3, "ACT_VM_RANGE_ATTACK3" },
|
||||
{ACT_VM_MELEE_ATTACK1, "ACT_VM_MELEE_ATTACK1" },
|
||||
{ACT_VM_MELEE_ATTACK2, "ACT_VM_MELEE_ATTACK2" },
|
||||
{ACT_VM_MELEE_ATTACK3, "ACT_VM_MELEE_ATTACK3" },
|
||||
{ACT_VM_SHOOT_EMPTY, "ACT_VM_SHOOT_EMPTY" },
|
||||
{ACT_VM_START_RELOAD, "ACT_VM_START_RELOAD" },
|
||||
{ACT_VM_RELOAD, "ACT_VM_RELOAD" },
|
||||
{ACT_VM_RELOAD_EMPTY, "ACT_VM_RELOAD_EMPTY" },
|
||||
{ACT_VM_TURNON, "ACT_VM_TURNON" },
|
||||
{ACT_VM_TURNOFF, "ACT_VM_TURNOFF" },
|
||||
{ACT_VM_PUMP, "ACT_VM_PUMP" }, // user animations
|
||||
{ACT_VM_PUMP_EMPTY, "ACT_VM_PUMP_EMPTY" },
|
||||
{ACT_VM_START_CHARGE, "ACT_VM_START_CHARGE" },
|
||||
{ACT_VM_CHARGE, "ACT_VM_CHARGE" },
|
||||
{ACT_VM_OVERLOAD, "ACT_VM_CHARGE" },
|
||||
{ACT_VM_IDLE_EMPTY, "ACT_VM_IDLE_EMPTY" },
|
||||
{0, NULL },
|
||||
};
|
||||
|
||||
void OptimizeAnimations( void )
|
||||
{
|
||||
int i, j;
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "platform.h"
|
||||
#include "byteorder.h"
|
||||
#include "utils.h"
|
||||
#include "bsplib.h"
|
||||
#include "mdllib.h"
|
||||
#include "blankframe.h"
|
||||
#include "builtin.h"
|
||||
|
||||
|
||||
int com_argc;
|
||||
|
@ -233,8 +234,8 @@ byte *ReadBMP (char *filename, byte **palette, int *width, int *height)
|
|||
if(!buf_p)
|
||||
{
|
||||
//blank_frame
|
||||
buf_p = (char *)blank_frame;
|
||||
filesize = sizeof(blank_frame);
|
||||
buf_p = (char *)blank_bmp;
|
||||
filesize = sizeof(blank_bmp);
|
||||
MsgDev( D_WARN, "ReadBMP: couldn't load %s, use blank image\n", filename );
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,41 @@
|
|||
|
||||
#include <time.h>
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
wavefile in memory representation
|
||||
|
||||
using with darkplaces video encoder-decoder
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
typedef struct wavefile_s
|
||||
{
|
||||
file_t *file; // file this is reading from
|
||||
|
||||
uint info_format; // these settings are read directly from the wave format (1 is uncompressed PCM)
|
||||
uint info_rate; // how many samples per second
|
||||
uint info_channels; // how many channels (1 = mono, 2 = stereo, 6 = 5.1 audio?)
|
||||
uint info_bits; // how many bits per channel (8 or 16)
|
||||
|
||||
// these settings are generated from the wave format
|
||||
// how many bytes in a sample (which may be one or two channels,
|
||||
// thus 1 or 2 or 2 or 4, depending on info_bytesperchannel)
|
||||
uint info_bytespersample;
|
||||
|
||||
// how many bytes in channel (1 for 8bit, or 2 for 16bit)
|
||||
uint info_bytesperchannel;
|
||||
|
||||
uint length; // how many samples in the wave file
|
||||
uint datalength; // how large the data chunk is
|
||||
uint dataposition; // beginning of data in data chunk
|
||||
uint position; // current position in stream (in samples)
|
||||
uint bufferlength; // these are private to the wave file functions, just used for processing size of *buffer
|
||||
|
||||
void *buffer; // buffer is reallocated if caller asks for more than fits
|
||||
} wavefile_t;
|
||||
|
||||
// bsplib compile flags
|
||||
#define BSP_ONLYENTS 0x01
|
||||
#define BSP_ONLYVIS 0x02
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "platform.h"
|
||||
#include "byteorder.h"
|
||||
#include "utils.h"
|
||||
|
||||
char wadoutname[MAX_SYSPATH];
|
||||
static dlumpinfo_t wadlumps[MAX_FILES_IN_PACK];
|
||||
static dlumpinfo_t wadlumps[MAX_FILES_IN_WAD];
|
||||
static char lumpname[MAX_SYSPATH];
|
||||
dwadinfo_t wadfile; // main header
|
||||
int wadheader;
|
||||
|
@ -62,7 +63,11 @@ void Wad3_AddLump( const char *name, bool compress )
|
|||
byte *buffer;
|
||||
int ofs, type, length;
|
||||
|
||||
Msg("Add lump %s\n", name );
|
||||
if( numlumps >= MAX_FILES_IN_WAD )
|
||||
{
|
||||
MsgDev( D_ERROR, "Wad3_AddLump: max files limit execeeds\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// we can load file from another wad
|
||||
buffer = FS_LoadFile( name, &length );
|
||||
|
@ -114,7 +119,7 @@ void Wad3_AddLump( const char *name, bool compress )
|
|||
FS_Write( handle, buffer, length ); // just write file
|
||||
}
|
||||
Mem_Free( buffer );
|
||||
MsgDev(D_NOTE, "AddLump: %s, size %d\n", info->name, info->disksize );
|
||||
MsgDev(D_INFO, "AddLump: %s, size %d\n", info->name, info->disksize );
|
||||
}
|
||||
|
||||
void Cmd_WadName( void )
|
||||
|
@ -130,16 +135,23 @@ void Cmd_WadType( void )
|
|||
if(Com_MatchToken( "Quake1") || Com_MatchToken( "Q1"))
|
||||
{
|
||||
wadheader = IDWAD2HEADER;
|
||||
allow_compression = false;
|
||||
}
|
||||
else if(Com_MatchToken( "Half-Life") || Com_MatchToken( "Hl1"))
|
||||
{
|
||||
wadheader = IDWAD3HEADER;
|
||||
allow_compression = false;
|
||||
}
|
||||
else if(Com_MatchToken( "Xash3D"))
|
||||
{
|
||||
wadheader = IDWAD4HEADER;
|
||||
allow_compression = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
wadheader = IDWAD3HEADER; // default
|
||||
allow_compression = false;
|
||||
}
|
||||
else wadheader = IDWAD3HEADER; // default
|
||||
}
|
||||
|
||||
void Cmd_AddLump( void )
|
||||
|
|
|
@ -71,5 +71,5 @@ if exist vsound\vsound.plg del /f /q vsound\vsound.plg
|
|||
echo Build succeeded!
|
||||
echo Please wait. Xash is now loading
|
||||
cd D:\Xash3D\
|
||||
quake.exe -log -game tmpQuArK -debug -dev 3 +map start
|
||||
quake.exe -log -game tmpQuArK -debug -dev 3
|
||||
:done
|
File diff suppressed because it is too large
Load Diff
|
@ -70,8 +70,8 @@ normal screenshot
|
|||
*/
|
||||
void CL_ScreenShot_f( void )
|
||||
{
|
||||
int i;
|
||||
char checkname[MAX_OSPATH];
|
||||
int i;
|
||||
string checkname;
|
||||
|
||||
// scan for a free filename
|
||||
for (i = 0; i <= 9999; i++ )
|
||||
|
@ -93,7 +93,7 @@ splash logo while map is loading
|
|||
*/
|
||||
void CL_LevelShot_f( void )
|
||||
{
|
||||
char checkname[MAX_OSPATH];
|
||||
string checkname;
|
||||
|
||||
// check for exist
|
||||
com.sprintf( checkname, "gfx/background/%s.tga", cl.configstrings[CS_NAME] );
|
||||
|
|
|
@ -12,8 +12,17 @@ cvar_t *con_speed;
|
|||
vec4_t console_color = {1.0, 1.0, 1.0, 1.0};
|
||||
int g_console_field_width = 78;
|
||||
|
||||
#define COLOR_BLACK '0'
|
||||
#define COLOR_RED '1'
|
||||
#define COLOR_GREEN '2'
|
||||
#define COLOR_YELLOW '3'
|
||||
#define COLOR_BLUE '4'
|
||||
#define COLOR_CYAN '5'
|
||||
#define COLOR_MAGENTA '6'
|
||||
#define COLOR_WHITE '7'
|
||||
|
||||
#define NUM_CON_TIMES 5 // need for 4 lines
|
||||
#define CON_TEXTSIZE MAX_INPUTLINE * 8 // 128 kb buffer
|
||||
#define CON_TEXTSIZE MAX_MSGLEN * 4 // 128 kb buffer
|
||||
#define DEFAULT_CONSOLE_WIDTH 78
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
/*
|
||||
====================
|
||||
|
|
|
@ -34,7 +34,7 @@ bool chat_team;
|
|||
// auto-complete stuff
|
||||
static field_t *completionField;
|
||||
static const char *completionString;
|
||||
static char shortestMatch[MAX_TOKEN_CHARS];
|
||||
static string shortestMatch;
|
||||
static int matchCount;
|
||||
|
||||
keyname_t keynames[] =
|
||||
|
@ -310,7 +310,7 @@ void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, b
|
|||
int drawLen;
|
||||
int prestep;
|
||||
int i, cursorChar;
|
||||
char str[MAX_STRING_CHARS];
|
||||
char str[MAX_SYSPATH];
|
||||
|
||||
drawLen = edit->widthInChars;
|
||||
len = strlen( edit->buffer ) + 1;
|
||||
|
@ -330,7 +330,7 @@ void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, b
|
|||
if ( prestep + drawLen > len ) drawLen = len - prestep;
|
||||
|
||||
// extract <drawLen> characters from the field at <prestep>
|
||||
if ( drawLen >= MAX_STRING_CHARS ) Host_Error("drawLen >= MAX_STRING_CHARS" );
|
||||
if ( drawLen >= MAX_SYSPATH ) Host_Error("drawLen >= MAX_SYSPATH" );
|
||||
|
||||
Mem_Copy( str, edit->buffer + prestep, drawLen );
|
||||
str[ drawLen ] = 0;
|
||||
|
@ -553,7 +553,7 @@ void Key_Console(int key)
|
|||
// if not in the game explicitly prepent a slash if needed
|
||||
if ( cls.state != ca_active && g_consoleField.buffer[0] != '\\' && g_consoleField.buffer[0] != '/' )
|
||||
{
|
||||
char temp[MAX_STRING_CHARS];
|
||||
char temp[MAX_SYSPATH];
|
||||
|
||||
com.strncpy( temp, g_consoleField.buffer, sizeof( temp ));
|
||||
com.sprintf( g_consoleField.buffer, "\\%s", temp );
|
||||
|
@ -679,7 +679,7 @@ In game talk message
|
|||
*/
|
||||
void Key_Message( int key )
|
||||
{
|
||||
char buffer[MAX_STRING_CHARS];
|
||||
char buffer[MAX_SYSPATH];
|
||||
|
||||
if(key == K_ESCAPE)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
cvar_t *freelook;
|
||||
cvar_t *rcon_client_password;
|
||||
|
@ -885,7 +886,7 @@ static const char *env_suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
|
|||
void CL_RequestNextDownload (void)
|
||||
{
|
||||
uint map_checksum; // for detecting cheater maps
|
||||
char fn[MAX_OSPATH];
|
||||
string fn;
|
||||
studiohdr_t *pheader;
|
||||
|
||||
if(cls.state != ca_connected)
|
||||
|
@ -1094,7 +1095,7 @@ void CL_RequestNextDownload (void)
|
|||
{
|
||||
while( precache_tex < pe->NumTextures())
|
||||
{
|
||||
char fn[MAX_OSPATH];
|
||||
string fn;
|
||||
|
||||
com.sprintf(fn, "textures/%s.tga", pe->GetTextureName( precache_tex++ ));
|
||||
if(!CL_CheckOrDownloadFile(fn)) return; // started a download
|
||||
|
@ -1388,7 +1389,7 @@ void CL_Frame( dword time )
|
|||
cls.realtime += time;
|
||||
cls.frametime = time * 0.001;
|
||||
|
||||
if( cls.frametime > (1.0 / 5)) cls.frametime = (1.0 / 5);
|
||||
if( cls.frametime > (1.0f / 5)) cls.frametime = (1.0f / 5);
|
||||
|
||||
// if in the debugger last frame, don't timeout
|
||||
if( time > 5000 ) cls.netchan.last_received = Sys_Milliseconds();
|
||||
|
|
|
@ -237,7 +237,7 @@ int mapcount = 0;
|
|||
|
||||
void PF_getmapslist( void )
|
||||
{
|
||||
char mapstring[MAX_INPUTLINE];
|
||||
char mapstring[MAX_MSGLEN];
|
||||
|
||||
if(!VM_ValidateArgs( "GetMapsList", 0 ))
|
||||
return;
|
||||
|
|
|
@ -105,7 +105,7 @@ Request a download from the server
|
|||
*/
|
||||
void CL_Download_f (void)
|
||||
{
|
||||
char filename[MAX_OSPATH];
|
||||
string filename;
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
{
|
||||
|
@ -225,8 +225,7 @@ void CL_ParseDownload( sizebuf_t *msg )
|
|||
}
|
||||
else
|
||||
{
|
||||
char oldn[MAX_OSPATH];
|
||||
char newn[MAX_OSPATH];
|
||||
string oldn, newn;
|
||||
|
||||
FS_Close (cls.download);
|
||||
|
||||
|
|
|
@ -0,0 +1,797 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// cl_video.c - playback cinematic
|
||||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
|
||||
#define DPVIDEO_VERSION 1
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DPVERROR_NONE = 0,
|
||||
DPVERROR_EOF,
|
||||
DPVERROR_READERROR,
|
||||
DPVERROR_INVALIDRMASK,
|
||||
DPVERROR_INVALIDGMASK,
|
||||
DPVERROR_INVALIDBMASK,
|
||||
DPVERROR_COLORMASKSOVERLAP,
|
||||
DPVERROR_COLORMASKSEXCEEDBPP,
|
||||
DPVERROR_UNSUPPORTEDBPP,
|
||||
} e_dpv_errors;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
cin_uninitialized = 0,
|
||||
cin_playback,
|
||||
cin_loop,
|
||||
cin_pause,
|
||||
cin_firstframe,
|
||||
} e_cin_status;
|
||||
|
||||
#define HZREADERROR_OK 0
|
||||
#define HZREADERROR_EOF 1
|
||||
#define HZREADERROR_MALLOCFAILED 2
|
||||
#define HZREADBLOCKSIZE 1048576
|
||||
|
||||
typedef struct hz_bitstream_read_s
|
||||
{
|
||||
file_t *file;
|
||||
int endoffile;
|
||||
} hz_bitstream_read_t;
|
||||
|
||||
typedef struct hz_block_s
|
||||
{
|
||||
struct hz_block_s *next;
|
||||
uint size;
|
||||
byte data[HZREADBLOCKSIZE];
|
||||
} hz_block_t;
|
||||
|
||||
typedef struct hz_blocks_s
|
||||
{
|
||||
hz_block_t *blocks;
|
||||
hz_block_t *current;
|
||||
uint position;
|
||||
uint store;
|
||||
int count;
|
||||
} hz_blocks_t;
|
||||
|
||||
hz_bitstream_read_t *hz_bitstream_read_open( const char *filename )
|
||||
{
|
||||
file_t *file;
|
||||
hz_bitstream_read_t *stream;
|
||||
|
||||
file = FS_Open( filename, "rb" );
|
||||
if( file )
|
||||
{
|
||||
stream = (hz_bitstream_read_t *)Mem_Alloc( cls.mempool, sizeof(hz_bitstream_read_t));
|
||||
stream->file = file;
|
||||
return stream;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void hz_bitstream_read_close( hz_bitstream_read_t *stream )
|
||||
{
|
||||
if( stream )
|
||||
{
|
||||
FS_Close( stream->file );
|
||||
Mem_Free( stream );
|
||||
}
|
||||
}
|
||||
|
||||
hz_blocks_t *hz_bitstream_read_blocks_new( void )
|
||||
{
|
||||
hz_blocks_t *blocks;
|
||||
|
||||
blocks = (hz_blocks_t *)Mem_Alloc( cls.mempool, sizeof(hz_blocks_t));
|
||||
return blocks;
|
||||
}
|
||||
|
||||
void hz_bitstream_read_blocks_free( hz_blocks_t *blocks )
|
||||
{
|
||||
hz_block_t *cur, *next;
|
||||
|
||||
if( blocks == NULL ) return;
|
||||
for( cur = blocks->blocks; cur; cur = next )
|
||||
{
|
||||
next = cur->next;
|
||||
Mem_Free( cur );
|
||||
}
|
||||
Mem_Free( blocks );
|
||||
}
|
||||
|
||||
void hz_bitstream_read_flushbits( hz_blocks_t *blocks )
|
||||
{
|
||||
blocks->store = 0;
|
||||
blocks->count = 0;
|
||||
}
|
||||
|
||||
bool hz_bitstream_read_blocks_read( hz_blocks_t *blocks, hz_bitstream_read_t *stream, uint size )
|
||||
{
|
||||
int s = size;
|
||||
hz_block_t *b = blocks->blocks, *p = NULL;
|
||||
|
||||
while( s > 0 )
|
||||
{
|
||||
if( b == NULL )
|
||||
{
|
||||
b = (hz_block_t *)Mem_Alloc( cls.mempool, sizeof(hz_block_t));
|
||||
b->next = NULL;
|
||||
b->size = 0;
|
||||
if( p != NULL )
|
||||
p->next = b;
|
||||
else blocks->blocks = b;
|
||||
}
|
||||
if( s > HZREADBLOCKSIZE )
|
||||
b->size = HZREADBLOCKSIZE;
|
||||
else b->size = s;
|
||||
s -= b->size;
|
||||
if(FS_Read( stream->file, b->data, b->size) != (fs_offset_t)b->size)
|
||||
{
|
||||
stream->endoffile = 1;
|
||||
break;
|
||||
}
|
||||
p = b;
|
||||
b = b->next;
|
||||
}
|
||||
while( b )
|
||||
{
|
||||
b->size = 0;
|
||||
b = b->next;
|
||||
}
|
||||
|
||||
blocks->current = blocks->blocks;
|
||||
blocks->position = 0;
|
||||
hz_bitstream_read_flushbits(blocks);
|
||||
if( stream->endoffile )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint hz_bitstream_read_blocks_getbyte(hz_blocks_t *blocks)
|
||||
{
|
||||
while (blocks->current != NULL && blocks->position >= blocks->current->size)
|
||||
{
|
||||
blocks->position = 0;
|
||||
blocks->current = blocks->current->next;
|
||||
}
|
||||
if (blocks->current == NULL)
|
||||
return 0;
|
||||
return blocks->current->data[blocks->position++];
|
||||
}
|
||||
|
||||
int hz_bitstream_read_bit( hz_blocks_t *blocks )
|
||||
{
|
||||
if( !blocks->count )
|
||||
{
|
||||
blocks->count += 8;
|
||||
blocks->store <<= 8;
|
||||
blocks->store |= hz_bitstream_read_blocks_getbyte(blocks) & 0xFF;
|
||||
}
|
||||
blocks->count--;
|
||||
return (blocks->store >> blocks->count) & 1;
|
||||
}
|
||||
|
||||
uint hz_bitstream_read_bits( hz_blocks_t *blocks, int size )
|
||||
{
|
||||
uint num = 0;
|
||||
|
||||
// we can only handle about 24 bits at a time safely
|
||||
// (there might be up to 7 bits more than we need in the bit store)
|
||||
if( size > 24 )
|
||||
{
|
||||
size -= 8;
|
||||
num |= hz_bitstream_read_bits(blocks, 8) << size;
|
||||
}
|
||||
while( blocks->count < size )
|
||||
{
|
||||
blocks->count += 8;
|
||||
blocks->store <<= 8;
|
||||
blocks->store |= hz_bitstream_read_blocks_getbyte(blocks) & 0xFF;
|
||||
}
|
||||
blocks->count -= size;
|
||||
num |= (blocks->store >> blocks->count) & ((1 << size) - 1);
|
||||
return num;
|
||||
}
|
||||
|
||||
uint hz_bitstream_read_byte( hz_blocks_t *blocks )
|
||||
{
|
||||
return hz_bitstream_read_blocks_getbyte( blocks );
|
||||
}
|
||||
|
||||
uint hz_bitstream_read_short( hz_blocks_t *blocks )
|
||||
{
|
||||
return (hz_bitstream_read_byte(blocks) << 8)|(hz_bitstream_read_byte(blocks));
|
||||
}
|
||||
|
||||
uint hz_bitstream_read_long( hz_blocks_t *blocks )
|
||||
{
|
||||
return (hz_bitstream_read_byte(blocks) << 24)|(hz_bitstream_read_byte(blocks) << 16)|(hz_bitstream_read_byte(blocks) << 8)|(hz_bitstream_read_byte(blocks));
|
||||
}
|
||||
|
||||
void hz_bitstream_read_bytes( hz_blocks_t *blocks, void *outdata, uint size )
|
||||
{
|
||||
byte *out;
|
||||
|
||||
out = (byte *)outdata;
|
||||
while( size-- ) *out++ = hz_bitstream_read_byte( blocks );
|
||||
}
|
||||
|
||||
typedef struct dpvstream_s
|
||||
{
|
||||
hz_bitstream_read_t *bitstream;
|
||||
hz_blocks_t *framedatablocks;
|
||||
|
||||
int error;
|
||||
|
||||
float info_framerate;
|
||||
uint info_frames;
|
||||
|
||||
uint info_imagewidth;
|
||||
uint info_imageheight;
|
||||
uint info_imagebpp;
|
||||
uint info_imageRloss;
|
||||
uint info_imageRmask;
|
||||
uint info_imageRshift;
|
||||
uint info_imageGloss;
|
||||
uint info_imageGmask;
|
||||
uint info_imageGshift;
|
||||
uint info_imageBloss;
|
||||
uint info_imageBmask;
|
||||
uint info_imageBshift;
|
||||
uint info_imagesize;
|
||||
|
||||
// current video frame data(needed because of delta compression)
|
||||
int videoframenum;
|
||||
uint *videopixels;
|
||||
|
||||
// channel the sound file is being played on
|
||||
int sndchan;
|
||||
} dpvstream_t;
|
||||
|
||||
static int dpv_setpixelformat( dpvstream_t *s, uint Rmask, uint Gmask, uint Bmask, uint bpp )
|
||||
{
|
||||
int Rshift, Rbits, Gshift, Gbits, Bshift, Bbits;
|
||||
if(!Rmask)
|
||||
{
|
||||
s->error = DPVERROR_INVALIDRMASK;
|
||||
return s->error;
|
||||
}
|
||||
if(!Gmask)
|
||||
{
|
||||
s->error = DPVERROR_INVALIDGMASK;
|
||||
return s->error;
|
||||
}
|
||||
if(!Bmask)
|
||||
{
|
||||
s->error = DPVERROR_INVALIDBMASK;
|
||||
return s->error;
|
||||
}
|
||||
if(Rmask & Gmask || Rmask & Bmask || Gmask & Bmask)
|
||||
{
|
||||
s->error = DPVERROR_COLORMASKSOVERLAP;
|
||||
return s->error;
|
||||
}
|
||||
switch( bpp )
|
||||
{
|
||||
case 2:
|
||||
if((Rmask | Gmask | Bmask) > 65536)
|
||||
{
|
||||
s->error = DPVERROR_COLORMASKSEXCEEDBPP;
|
||||
return s->error;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
default:
|
||||
s->error = DPVERROR_UNSUPPORTEDBPP;
|
||||
return s->error;
|
||||
break;
|
||||
}
|
||||
for (Rshift = 0;!(Rmask & 1);Rshift++, Rmask >>= 1);
|
||||
for (Gshift = 0;!(Gmask & 1);Gshift++, Gmask >>= 1);
|
||||
for (Bshift = 0;!(Bmask & 1);Bshift++, Bmask >>= 1);
|
||||
if (((Rmask + 1) & Rmask) != 0)
|
||||
{
|
||||
s->error = DPVERROR_INVALIDRMASK;
|
||||
return s->error;
|
||||
}
|
||||
if (((Gmask + 1) & Gmask) != 0)
|
||||
{
|
||||
s->error = DPVERROR_INVALIDGMASK;
|
||||
return s->error;
|
||||
}
|
||||
if (((Bmask + 1) & Bmask) != 0)
|
||||
{
|
||||
s->error = DPVERROR_INVALIDBMASK;
|
||||
return s->error;
|
||||
}
|
||||
for (Rbits = 0;Rmask & 1;Rbits++, Rmask >>= 1);
|
||||
for (Gbits = 0;Gmask & 1;Gbits++, Gmask >>= 1);
|
||||
for (Bbits = 0;Bmask & 1;Bbits++, Bmask >>= 1);
|
||||
if (Rbits > 8)
|
||||
{
|
||||
Rshift += (Rbits - 8);
|
||||
Rbits = 8;
|
||||
}
|
||||
if (Gbits > 8)
|
||||
{
|
||||
Gshift += (Gbits - 8);
|
||||
Gbits = 8;
|
||||
}
|
||||
if (Bbits > 8)
|
||||
{
|
||||
Bshift += (Bbits - 8);
|
||||
Bbits = 8;
|
||||
}
|
||||
s->info_imagebpp = bpp;
|
||||
s->info_imageRloss = 16 + (8 - Rbits);
|
||||
s->info_imageGloss = 8 + (8 - Gbits);
|
||||
s->info_imageBloss = 0 + (8 - Bbits);
|
||||
s->info_imageRmask = (1 << Rbits) - 1;
|
||||
s->info_imageGmask = (1 << Gbits) - 1;
|
||||
s->info_imageBmask = (1 << Bbits) - 1;
|
||||
s->info_imageRshift = Rshift;
|
||||
s->info_imageGshift = Gshift;
|
||||
s->info_imageBshift = Bshift;
|
||||
s->info_imagesize = s->info_imagewidth * s->info_imageheight * s->info_imagebpp;
|
||||
return s->error;
|
||||
}
|
||||
|
||||
// opening and closing streams
|
||||
|
||||
// opens a stream
|
||||
void *dpv_open( const char *filename, char **errorstring )
|
||||
{
|
||||
dpvstream_t *s;
|
||||
char t[8];
|
||||
|
||||
if( errorstring != NULL ) *errorstring = NULL;
|
||||
|
||||
s = (dpvstream_t *)Mem_Alloc( cls.mempool, sizeof(dpvstream_t));
|
||||
s->bitstream = hz_bitstream_read_open( filename );
|
||||
if( s->bitstream != NULL )
|
||||
{
|
||||
// check file identification
|
||||
s->framedatablocks = hz_bitstream_read_blocks_new();
|
||||
hz_bitstream_read_blocks_read(s->framedatablocks, s->bitstream, 8);
|
||||
hz_bitstream_read_bytes(s->framedatablocks, t, 8);
|
||||
if(!memcmp(t, "DPVideo", 8))
|
||||
{
|
||||
// check version number
|
||||
hz_bitstream_read_blocks_read( s->framedatablocks, s->bitstream, 2 );
|
||||
if( hz_bitstream_read_short(s->framedatablocks) == DPVIDEO_VERSION )
|
||||
{
|
||||
hz_bitstream_read_blocks_read(s->framedatablocks, s->bitstream, 12);
|
||||
s->info_imagewidth = hz_bitstream_read_short(s->framedatablocks);
|
||||
s->info_imageheight = hz_bitstream_read_short(s->framedatablocks);
|
||||
s->info_framerate = (float)hz_bitstream_read_long(s->framedatablocks) * (1.0/65536.0);
|
||||
|
||||
if( s->info_framerate > 0.0f )
|
||||
{
|
||||
s->videopixels = (uint *)Z_Malloc(s->info_imagewidth * s->info_imageheight * sizeof(*s->videopixels));
|
||||
s->videoframenum = MAX_HEARTBEAT;
|
||||
return s;
|
||||
}
|
||||
else if( errorstring != NULL ) *errorstring = "error in video info chunk";
|
||||
}
|
||||
else if( errorstring != NULL ) *errorstring = "read error";
|
||||
}
|
||||
else if( errorstring != NULL ) *errorstring = "not a dpvideo file";
|
||||
hz_bitstream_read_blocks_free(s->framedatablocks);
|
||||
}
|
||||
else if( errorstring != NULL ) *errorstring = "unable to open file";
|
||||
Mem_Free( s );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// closes a stream
|
||||
void dpv_close( void *stream )
|
||||
{
|
||||
dpvstream_t *s = (dpvstream_t *)stream;
|
||||
|
||||
if( s == NULL ) return;
|
||||
if( s->videopixels ) Mem_Free( s->videopixels );
|
||||
if( s->sndchan != -1 ) S_StopAllSounds(); //FIXME
|
||||
if( s->framedatablocks ) hz_bitstream_read_blocks_free( s->framedatablocks );
|
||||
if( s->bitstream ) hz_bitstream_read_close( s->bitstream );
|
||||
Mem_Free( s );
|
||||
}
|
||||
|
||||
// utilitarian functions
|
||||
int dpv_error( void *stream, char **errorstring )
|
||||
{
|
||||
dpvstream_t *s = (dpvstream_t *)stream;
|
||||
int e = s->error;
|
||||
|
||||
s->error = 0; // clear last error
|
||||
if( errorstring )
|
||||
{
|
||||
switch( e )
|
||||
{
|
||||
case DPVERROR_NONE:
|
||||
*errorstring = "no error";
|
||||
break;
|
||||
case DPVERROR_EOF:
|
||||
*errorstring = "end of file reached (this is not an error)";
|
||||
break;
|
||||
case DPVERROR_READERROR:
|
||||
*errorstring = "read error (corrupt or incomplete file)";
|
||||
break;
|
||||
case DPVERROR_INVALIDRMASK:
|
||||
*errorstring = "invalid red bits mask";
|
||||
break;
|
||||
case DPVERROR_INVALIDGMASK:
|
||||
*errorstring = "invalid green bits mask";
|
||||
break;
|
||||
case DPVERROR_INVALIDBMASK:
|
||||
*errorstring = "invalid blue bits mask";
|
||||
break;
|
||||
case DPVERROR_COLORMASKSOVERLAP:
|
||||
*errorstring = "color bit masks overlap";
|
||||
break;
|
||||
case DPVERROR_COLORMASKSEXCEEDBPP:
|
||||
*errorstring = "color masks too big for specified bytes per pixel";
|
||||
break;
|
||||
case DPVERROR_UNSUPPORTEDBPP:
|
||||
*errorstring = "unsupported bytes per pixel (must be 2 for 16bit, or 4 for 32bit)";
|
||||
break;
|
||||
default:
|
||||
*errorstring = "unknown error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
// returns the width of the image data
|
||||
uint dpv_getwidth( const void *stream )
|
||||
{
|
||||
dpvstream_t *s = (dpvstream_t *)stream;
|
||||
return s->info_imagewidth;
|
||||
}
|
||||
|
||||
// returns the height of the image data
|
||||
uint dpv_getheight( const void *stream )
|
||||
{
|
||||
dpvstream_t *s = (dpvstream_t *)stream;
|
||||
return s->info_imageheight;
|
||||
}
|
||||
|
||||
// returns the framerate of the stream
|
||||
float dpv_getframerate( const void *stream )
|
||||
{
|
||||
dpvstream_t *s = (dpvstream_t *)stream;
|
||||
return s->info_framerate;
|
||||
}
|
||||
|
||||
|
||||
static int dpv_convertpixels( dpvstream_t *s, void *imagedata, int imagebytesperrow )
|
||||
{
|
||||
uint a, x, y, width, height;
|
||||
uint Rloss, Rmask, Rshift, Gloss, Gmask, Gshift, Bloss, Bmask, Bshift;
|
||||
uint *in;
|
||||
|
||||
width = s->info_imagewidth;
|
||||
height = s->info_imageheight;
|
||||
|
||||
Rloss = s->info_imageRloss;
|
||||
Rmask = s->info_imageRmask;
|
||||
Rshift = s->info_imageRshift;
|
||||
Gloss = s->info_imageGloss;
|
||||
Gmask = s->info_imageGmask;
|
||||
Gshift = s->info_imageGshift;
|
||||
Bloss = s->info_imageBloss;
|
||||
Bmask = s->info_imageBmask;
|
||||
Bshift = s->info_imageBshift;
|
||||
|
||||
in = s->videopixels;
|
||||
if( s->info_imagebpp == 4 )
|
||||
{
|
||||
uint *outrow;
|
||||
for( y = 0; y < height; y++ )
|
||||
{
|
||||
outrow = (uint *)((byte *)imagedata + y * imagebytesperrow);
|
||||
for (x = 0;x < width;x++)
|
||||
{
|
||||
a = *in++;
|
||||
outrow[x] = (((a >> Rloss) & Rmask) << Rshift) | (((a >> Gloss) & Gmask) << Gshift) | (((a >> Bloss) & Bmask) << Bshift);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
word *outrow;
|
||||
for( y = 0; y < height; y++ )
|
||||
{
|
||||
outrow = (word *)((byte *)imagedata + y * imagebytesperrow);
|
||||
if (Rloss == 19 && Gloss == 10 && Bloss == 3 && Rshift == 11 && Gshift == 5 && Bshift == 0)
|
||||
{
|
||||
// optimized
|
||||
for (x = 0;x < width;x++)
|
||||
{
|
||||
a = *in++;
|
||||
outrow[x] = ((a >> 8) & 0xF800) | ((a >> 5) & 0x07E0) | ((a >> 3) & 0x001F);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (x = 0;x < width;x++)
|
||||
{
|
||||
a = *in++;
|
||||
outrow[x] = (((a >> Rloss) & Rmask) << Rshift) | (((a >> Gloss) & Gmask) << Gshift) | (((a >> Bloss) & Bmask) << Bshift);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return s->error;
|
||||
}
|
||||
|
||||
static int dpv_decompressimage( dpvstream_t *s )
|
||||
{
|
||||
int i, a, b, colors, x1, y1, bw, bh, width, height, palettebits;
|
||||
uint palette[256], *outrow, *out;
|
||||
|
||||
width = s->info_imagewidth;
|
||||
height = s->info_imageheight;
|
||||
|
||||
for( y1 = 0; y1 < height; y1 += 8 )
|
||||
{
|
||||
outrow = s->videopixels + y1 * width;
|
||||
bh = 8;
|
||||
if( y1 + bh > height ) bh = height - y1;
|
||||
for( x1 = 0; x1 < width; x1 += 8 )
|
||||
{
|
||||
out = outrow + x1;
|
||||
bw = 8;
|
||||
if( x1 + bw > width ) bw = width - x1;
|
||||
if( hz_bitstream_read_bit(s->framedatablocks))
|
||||
{
|
||||
// updated block
|
||||
palettebits = hz_bitstream_read_bits( s->framedatablocks, 3 );
|
||||
colors = 1 << palettebits;
|
||||
for (i = 0; i < colors; i++ )
|
||||
palette[i] = hz_bitstream_read_bits(s->framedatablocks, 24);
|
||||
if( palettebits )
|
||||
{
|
||||
for( b = 0; b < bh; b++, out += width )
|
||||
for( a = 0; a < bw; a++)
|
||||
out[a] = palette[hz_bitstream_read_bits(s->framedatablocks, palettebits)];
|
||||
}
|
||||
else
|
||||
{
|
||||
for( b = 0; b < bh; b++, out += width )
|
||||
for( a = 0; a < bw; a++) out[a] = palette[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return s->error;
|
||||
}
|
||||
|
||||
// decodes a video frame to the supplied output pixels
|
||||
int dpv_video( void *stream, void *imagedata, uint Rmask, uint Gmask, uint Bmask, uint bpp, int bpr )
|
||||
{
|
||||
dpvstream_t *s = (dpvstream_t *)stream;
|
||||
uint framedatasize;
|
||||
char t[4];
|
||||
|
||||
s->error = DPVERROR_NONE;
|
||||
if( dpv_setpixelformat( s, Rmask, Gmask, Bmask, bpp ))
|
||||
return s->error;
|
||||
|
||||
hz_bitstream_read_blocks_read( s->framedatablocks, s->bitstream, 8 );
|
||||
hz_bitstream_read_bytes( s->framedatablocks, t, 4 );
|
||||
if(memcmp(t, "VID0", 4))
|
||||
{
|
||||
if( t[0] == 0 ) return (s->error = DPVERROR_EOF);
|
||||
return (s->error = DPVERROR_READERROR);
|
||||
}
|
||||
framedatasize = hz_bitstream_read_long( s->framedatablocks );
|
||||
hz_bitstream_read_blocks_read( s->framedatablocks, s->bitstream, framedatasize );
|
||||
if (dpv_decompressimage(s))
|
||||
return s->error;
|
||||
|
||||
dpv_convertpixels( s, imagedata, bpr );
|
||||
return s->error;
|
||||
}
|
||||
|
||||
|
||||
void *stream;
|
||||
byte *frame_data = NULL;
|
||||
uint frame_width;
|
||||
uint frame_height;
|
||||
int frame_num;
|
||||
int start_time;
|
||||
float frame_rate;
|
||||
int frame_bpp;
|
||||
int cin_state;
|
||||
int cin_rmask;
|
||||
int cin_gmask;
|
||||
int cin_bmask;
|
||||
|
||||
/*
|
||||
==================
|
||||
CIN_StopCinematic
|
||||
==================
|
||||
*/
|
||||
void CIN_StopCinematic( void )
|
||||
{
|
||||
if( stream )
|
||||
{
|
||||
dpv_close( stream );
|
||||
stream = NULL;
|
||||
}
|
||||
if( cin_state == cin_playback )
|
||||
cin_state = cin_firstframe;
|
||||
|
||||
// let game known about movie state
|
||||
cls.state = ca_disconnected;
|
||||
Cbuf_ExecuteText(EXEC_APPEND, "killserver\n");
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CIN_RunCinematic
|
||||
|
||||
decompress next frame
|
||||
==================
|
||||
*/
|
||||
void CIN_RunCinematic( void )
|
||||
{
|
||||
int destframe;
|
||||
|
||||
if( cls.state != ca_cinematic )
|
||||
return;
|
||||
|
||||
if( cin_state == cin_firstframe )
|
||||
{
|
||||
destframe = 0;
|
||||
cin_state = cin_playback;
|
||||
}
|
||||
else destframe = (int)(((cls.realtime - start_time) * 0.001) * frame_rate);
|
||||
|
||||
if( destframe < 0 ) destframe = 0;
|
||||
if( destframe > frame_num )
|
||||
{
|
||||
do {
|
||||
frame_num++;
|
||||
if( dpv_video( stream, frame_data, cin_rmask, cin_gmask, cin_bmask, 4, frame_width * 4 ))
|
||||
{
|
||||
// finished?
|
||||
CIN_StopCinematic();
|
||||
return;
|
||||
}
|
||||
} while( frame_num < destframe );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CIN_DrawCinematic
|
||||
|
||||
==================
|
||||
*/
|
||||
void CIN_DrawCinematic( void )
|
||||
{
|
||||
float x, y, w, h;
|
||||
|
||||
if( cls.state != ca_cinematic )
|
||||
return;
|
||||
|
||||
x = y = 0;
|
||||
w = SCREEN_WIDTH;
|
||||
h = SCREEN_HEIGHT;
|
||||
SCR_AdjustSize( &x, &y, &w, &h );
|
||||
|
||||
re->DrawStretchRaw( x, y, w, h, frame_width, frame_height, frame_data, true );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CIN_PlayCinematic
|
||||
|
||||
==================
|
||||
*/
|
||||
bool CIN_PlayCinematic( const char *filename )
|
||||
{
|
||||
char *errorstring;
|
||||
union
|
||||
{
|
||||
byte b[4];
|
||||
uint i;
|
||||
} bgra;
|
||||
|
||||
stream = dpv_open( filename, &errorstring );
|
||||
if( !stream )
|
||||
{
|
||||
CIN_StopCinematic();
|
||||
MsgDev( D_ERROR, "%s\n", errorstring );
|
||||
return false;
|
||||
}
|
||||
|
||||
// set masks in an endian-independent way (as they really represent bytes)
|
||||
bgra.i = 0;
|
||||
bgra.b[2] = 0xFF;
|
||||
cin_bmask = bgra.i;
|
||||
|
||||
bgra.i = 0;
|
||||
bgra.b[1] = 0xFF;
|
||||
cin_gmask = bgra.i;
|
||||
|
||||
bgra.i = 0;
|
||||
bgra.b[0] = 0xFF;
|
||||
cin_rmask = bgra.i;
|
||||
|
||||
frame_width = dpv_getwidth( stream );
|
||||
frame_height = dpv_getheight( stream );
|
||||
frame_data = Mem_Realloc( cls.mempool, frame_data, frame_width * frame_height * 4 );
|
||||
|
||||
cin_state = cin_firstframe;
|
||||
frame_num = -1;
|
||||
frame_rate = dpv_getframerate( stream );
|
||||
start_time = cls.realtime;
|
||||
cls.state = ca_cinematic;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
Cinematic user interface
|
||||
==============================================================================
|
||||
*/
|
||||
bool SCR_PlayCinematic( char *name, int bits )
|
||||
{
|
||||
string path;
|
||||
|
||||
if( cls.state == ca_cinematic )
|
||||
SCR_StopCinematic();
|
||||
|
||||
com.sprintf( path, "video/%s", name );
|
||||
FS_DefaultExtension( path, ".dpv" );
|
||||
|
||||
S_StopAllSounds();
|
||||
//S_StartStreaming();
|
||||
|
||||
if(CIN_PlayCinematic( path ))
|
||||
{
|
||||
SCR_RunCinematic(); // load first frame
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SCR_DrawCinematic( void )
|
||||
{
|
||||
CIN_DrawCinematic();
|
||||
}
|
||||
|
||||
void SCR_RunCinematic( void )
|
||||
{
|
||||
CIN_RunCinematic();
|
||||
}
|
||||
|
||||
void SCR_StopCinematic( void )
|
||||
{
|
||||
CIN_StopCinematic();
|
||||
S_StopAllSounds();
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
SCR_FinishCinematic
|
||||
|
||||
Called when either the cinematic completes, or it is aborted
|
||||
====================
|
||||
*/
|
||||
void SCR_FinishCinematic( void )
|
||||
{
|
||||
// tell the server to advance to the next map / cinematic
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_Print( &cls.netchan.message, va("nextserver %i\n", cl.servercount));
|
||||
}
|
|
@ -23,12 +23,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define CLIENT_H
|
||||
|
||||
#include "mathlib.h"
|
||||
#include "basefiles.h"
|
||||
#include "cl_edict.h"
|
||||
|
||||
#define MAX_EDIT_LINE 256
|
||||
#define COMMAND_HISTORY 32
|
||||
#define MAX_SERVERS 64
|
||||
#define ColorIndex(c) (((c) - '0') & 7)
|
||||
|
||||
//=============================================================================
|
||||
typedef struct frame_s
|
||||
|
@ -222,8 +222,8 @@ typedef struct
|
|||
int challenge; // from the server to use for connecting
|
||||
|
||||
file_t *download; // file transfer from server
|
||||
char downloadtempname[MAX_OSPATH];
|
||||
char downloadname[MAX_OSPATH];
|
||||
string downloadtempname;
|
||||
string downloadname;
|
||||
int downloadnumber;
|
||||
dltype_t downloadtype;
|
||||
int downloadpercent;
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "basefiles.h"
|
||||
#include "byteorder.h"
|
||||
#include "mathlib.h"
|
||||
#include "client.h"
|
||||
#include "server.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
@ -17,7 +18,7 @@ SYSTEM IO
|
|||
*/
|
||||
void Sys_Error( const char *error, ... )
|
||||
{
|
||||
char errorstring[MAX_INPUTLINE];
|
||||
char errorstring[MAX_SYSPATH];
|
||||
static bool recursive = false;
|
||||
va_list argptr;
|
||||
|
||||
|
@ -100,7 +101,7 @@ supports follow prefixes:
|
|||
*/
|
||||
const char *VM_VarArgs( int start_arg )
|
||||
{
|
||||
static char vm_string[MAX_STRING_CHARS];
|
||||
static char vm_string[MAX_SYSPATH];
|
||||
int arg = start_arg + 1;// skip format string
|
||||
char *out, *outend;
|
||||
static string vm_arg;
|
||||
|
@ -111,8 +112,8 @@ const char *VM_VarArgs( int start_arg )
|
|||
// get the format string
|
||||
s = PRVM_G_STRING((OFS_PARM0 + start_arg * 3));
|
||||
out = vm_string;
|
||||
outend = out + MAX_STRING_CHARS - 1;
|
||||
memset( vm_string, 0, MAX_STRING_CHARS - 1 );
|
||||
outend = out + MAX_SYSPATH - 1;
|
||||
memset( vm_string, 0, MAX_SYSPATH - 1 );
|
||||
|
||||
while( out < outend && *s )
|
||||
{
|
||||
|
@ -1063,7 +1064,7 @@ string fgets( float handle )
|
|||
*/
|
||||
void VM_FS_Gets( void )
|
||||
{
|
||||
static char string[MAX_INPUTLINE];
|
||||
static char string[MAX_MSGLEN];
|
||||
vfile_t *handle;
|
||||
int c;
|
||||
|
||||
|
@ -1071,7 +1072,7 @@ void VM_FS_Gets( void )
|
|||
handle = VM_GetFileHandle((int)PRVM_G_FLOAT( OFS_PARM0 ));
|
||||
if(!handle) return;
|
||||
|
||||
c = VFS_Gets( handle, string, MAX_INPUTLINE );
|
||||
c = VFS_Gets( handle, string, MAX_MSGLEN );
|
||||
if( c >= 0 ) PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString( string );
|
||||
else PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString( NULL );
|
||||
}
|
||||
|
@ -2143,7 +2144,7 @@ bool Cmd_GetMovieList( const char *s, char *completedname, int length )
|
|||
string matchbuf;
|
||||
int i, nummovies;
|
||||
|
||||
t = FS_Search(va("video/%s*.roq", s ), true);
|
||||
t = FS_Search(va("video/%s*.dpv", s ), true);
|
||||
if(!t) return false;
|
||||
|
||||
FS_FileBase(t->filenames[0], matchbuf );
|
||||
|
@ -2154,7 +2155,7 @@ bool Cmd_GetMovieList( const char *s, char *completedname, int length )
|
|||
{
|
||||
const char *ext = FS_FileExtension( t->filenames[i] );
|
||||
|
||||
if( com.stricmp(ext, "roq" )) continue;
|
||||
if( com.stricmp( ext, "dpv" )) continue;
|
||||
FS_FileBase(t->filenames[i], matchbuf );
|
||||
Msg("%16s\n", matchbuf );
|
||||
nummovies++;
|
||||
|
|
|
@ -11,10 +11,7 @@
|
|||
#include <windows.h>
|
||||
|
||||
#include "basetypes.h"
|
||||
#include "stdapi.h"
|
||||
#include "stdref.h"
|
||||
#include "basefiles.h"
|
||||
#include "dllapi.h"
|
||||
#include "ref_dllapi.h"
|
||||
#include "net_msg.h"
|
||||
|
||||
// linked interfaces
|
||||
|
@ -391,6 +388,10 @@ MISC COMMON FUNCTIONS
|
|||
|
||||
==============================================================
|
||||
*/
|
||||
#define MAX_INFO_KEY 64
|
||||
#define MAX_INFO_VALUE 64
|
||||
#define MAX_INFO_STRING 512
|
||||
|
||||
// client printf level
|
||||
enum e_clprint
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "mathlib.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
/*
|
||||
packet header ( size in bits )
|
||||
|
@ -482,7 +483,7 @@ Traps "localhost" for loopback, passes everything else to system
|
|||
bool NET_StringToAdr( const char *s, netadr_t *a )
|
||||
{
|
||||
bool r;
|
||||
char *port, base[MAX_STRING_CHARS];
|
||||
char *port, base[MAX_SYSPATH];
|
||||
|
||||
if(!com.strcmp( s, "localhost" ))
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "builtin.h"
|
||||
|
||||
#define VALUE(a) ((int )(a))
|
||||
#define NODE(a) ((void *)(a))
|
||||
|
@ -20,41 +21,7 @@ typedef void *tree_t[HUFF_TREE_SIZE];
|
|||
//
|
||||
// pre-defined frequency counts for all bytes [0..255]
|
||||
//
|
||||
static int huffCounts[256] =
|
||||
{
|
||||
0x3D1CB, 0x0A0E9, 0x01894, 0x01BC2, 0x00E92, 0x00EA6, 0x017DE, 0x05AF3,
|
||||
0x08225, 0x01B26, 0x01E9E, 0x025F2, 0x02429, 0x0436B, 0x00F6D, 0x006F2,
|
||||
0x02060, 0x00644, 0x00636, 0x0067F, 0x0044C, 0x004BD, 0x004D6, 0x0046E,
|
||||
0x006D5, 0x00423, 0x004DE, 0x0047D, 0x004F9, 0x01186, 0x00AF5, 0x00D90,
|
||||
0x0553B, 0x00487, 0x00686, 0x0042A, 0x00413, 0x003F4, 0x0041D, 0x0042E,
|
||||
0x006BE, 0x00378, 0x0049C, 0x00352, 0x003C0, 0x0030C, 0x006D8, 0x00CE0,
|
||||
0x02986, 0x011A2, 0x016F9, 0x00A7D, 0x0122A, 0x00EFD, 0x0082D, 0x0074B,
|
||||
0x00A18, 0x0079D, 0x007B4, 0x003AC, 0x0046E, 0x006FC, 0x00686, 0x004B6,
|
||||
0x01657, 0x017F0, 0x01C36, 0x019FE, 0x00E7E, 0x00ED3, 0x005D4, 0x005F4,
|
||||
0x008A7, 0x00474, 0x0054B, 0x003CB, 0x00884, 0x004E0, 0x00530, 0x004AB,
|
||||
0x006EA, 0x00436, 0x004F0, 0x004F2, 0x00490, 0x003C5, 0x00483, 0x004A2,
|
||||
0x00543, 0x004CC, 0x005F9, 0x00640, 0x00A39, 0x00800, 0x009F2, 0x00CCB,
|
||||
0x0096A, 0x00E01, 0x009C8, 0x00AF0, 0x00A73, 0x01802, 0x00E4F, 0x00B18,
|
||||
0x037AD, 0x00C5C, 0x008AD, 0x00697, 0x00C88, 0x00AB3, 0x00DB8, 0x012BC,
|
||||
0x00FFB, 0x00DBB, 0x014A8, 0x00FB0, 0x01F01, 0x0178F, 0x014F0, 0x00F54,
|
||||
0x0131C, 0x00E9F, 0x011D6, 0x012C7, 0x016DC, 0x01900, 0x01851, 0x02063,
|
||||
0x05ACB, 0x01E9E, 0x01BA1, 0x022E7, 0x0153D, 0x01183, 0x00E39, 0x01488,
|
||||
0x014C0, 0x014D0, 0x014FA, 0x00DA4, 0x0099A, 0x0069E, 0x0071D, 0x00849,
|
||||
0x0077C, 0x0047D, 0x005EC, 0x00557, 0x004D4, 0x00405, 0x004EA, 0x00450,
|
||||
0x004DD, 0x003EE, 0x0047D, 0x00401, 0x004D9, 0x003B8, 0x00507, 0x003E5,
|
||||
0x006B1, 0x003F1, 0x004A3, 0x0036F, 0x0044B, 0x003A1, 0x00436, 0x003B7,
|
||||
0x00678, 0x003A2, 0x00481, 0x00406, 0x004EE, 0x00426, 0x004BE, 0x00424,
|
||||
0x00655, 0x003A2, 0x00452, 0x00390, 0x0040A, 0x0037C, 0x00486, 0x003DE,
|
||||
0x00497, 0x00352, 0x00461, 0x00387, 0x0043F, 0x00398, 0x00478, 0x00420,
|
||||
0x00D86, 0x008C0, 0x0112D, 0x02F68, 0x01E4E, 0x00541, 0x0051B, 0x00CCE,
|
||||
0x0079E, 0x00376, 0x003FF, 0x00458, 0x00435, 0x00412, 0x00425, 0x0042F,
|
||||
0x005CC, 0x003E9, 0x00448, 0x00393, 0x0041C, 0x003E3, 0x0042E, 0x0036C,
|
||||
0x00457, 0x00353, 0x00423, 0x00325, 0x00458, 0x0039B, 0x0044F, 0x00331,
|
||||
0x0076B, 0x00750, 0x003D0, 0x00349, 0x00467, 0x003BC, 0x00487, 0x003B6,
|
||||
0x01E6F, 0x003BA, 0x00509, 0x003A5, 0x00467, 0x00C87, 0x003FC, 0x0039F,
|
||||
0x0054B, 0x00300, 0x00410, 0x002E9, 0x003B8, 0x00325, 0x00431, 0x002E4,
|
||||
0x003F5, 0x00325, 0x003F0, 0x0031C, 0x003E4, 0x00421, 0x02CC1, 0x034C0
|
||||
};
|
||||
|
||||
|
||||
// static Huffman tree
|
||||
static tree_t huffTree;
|
||||
|
@ -602,7 +569,7 @@ void Huff_Init( void )
|
|||
|
||||
// add all pre-defined byte references
|
||||
for( i = 0; i < 256; i++ )
|
||||
for( j = 0; j < huffCounts[i]; j++ )
|
||||
for( j = 0; j < huff_tree[i]; j++ )
|
||||
Huff_AddReference( huffTree, i );
|
||||
huffInit = true;
|
||||
}
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "common.h"
|
||||
#include "byteorder.h"
|
||||
#include "mathlib.h"
|
||||
#include "builtin.h"
|
||||
|
||||
|
@ -272,12 +273,12 @@ void _MSG_WriteString( sizebuf_t *sb, const char *s, const char *filename, int f
|
|||
else
|
||||
{
|
||||
int l, i;
|
||||
char string[MAX_STRING_CHARS];
|
||||
char string[MAX_SYSPATH];
|
||||
|
||||
l = com.strlen( s ) + 1;
|
||||
if( l >= MAX_STRING_CHARS )
|
||||
if( l >= MAX_SYSPATH )
|
||||
{
|
||||
MsgDev( D_ERROR, "MSG_WriteString: exceeds MAX_STRING_CHARS (called at %s:%i\n", filename, fileline );
|
||||
MsgDev( D_ERROR, "MSG_WriteString: exceeds %i symbols (called at %s:%i\n", MAX_SYSPATH, filename, fileline );
|
||||
_MSG_WriteData( sb, "", 1, filename, fileline );
|
||||
return;
|
||||
}
|
||||
|
@ -314,7 +315,7 @@ float MSG_ReadFloat( sizebuf_t *msg )
|
|||
|
||||
char *MSG_ReadString( sizebuf_t *msg )
|
||||
{
|
||||
static char string[MAX_STRING_CHARS];
|
||||
static char string[MAX_SYSPATH];
|
||||
int l = 0, c;
|
||||
|
||||
do
|
||||
|
@ -339,7 +340,7 @@ char *MSG_ReadString( sizebuf_t *msg )
|
|||
|
||||
char *MSG_ReadStringLine( sizebuf_t *msg )
|
||||
{
|
||||
static char string[MAX_STRING_CHARS];
|
||||
static char string[MAX_SYSPATH];
|
||||
int l = 0, c;
|
||||
|
||||
do
|
||||
|
|
|
@ -5,6 +5,39 @@
|
|||
#ifndef NET_MSG_H
|
||||
#define NET_MSG_H
|
||||
|
||||
enum net_types_e
|
||||
{
|
||||
NET_BAD = 0,
|
||||
NET_CHAR,
|
||||
NET_BYTE,
|
||||
NET_SHORT,
|
||||
NET_WORD,
|
||||
NET_LONG,
|
||||
NET_FLOAT,
|
||||
NET_ANGLE,
|
||||
NET_SCALE,
|
||||
NET_COORD,
|
||||
NET_COLOR,
|
||||
NET_TYPES,
|
||||
};
|
||||
|
||||
typedef struct net_desc_s
|
||||
{
|
||||
int type; // pixelformat
|
||||
char name[8]; // used for debug
|
||||
int min_range;
|
||||
int max_range;
|
||||
} net_desc_t;
|
||||
|
||||
// communication state description
|
||||
typedef struct net_field_s
|
||||
{
|
||||
char *name;
|
||||
int offset;
|
||||
int bits;
|
||||
bool force; // will be send for newentity
|
||||
} net_field_t;
|
||||
|
||||
// server to client
|
||||
enum svc_ops_e
|
||||
{
|
||||
|
@ -54,6 +87,21 @@ typedef enum
|
|||
MSG_PVS_R,
|
||||
} msgtype_t;
|
||||
|
||||
static const net_desc_t NWDesc[] =
|
||||
{
|
||||
{ NET_BAD, "none", 0, 0 }, // full range
|
||||
{ NET_CHAR, "Char", -128, 127 },
|
||||
{ NET_BYTE, "Byte", 0, 255 },
|
||||
{ NET_SHORT, "Short", -32767, 32767 },
|
||||
{ NET_WORD, "Word", 0, 65535 },
|
||||
{ NET_LONG, "Long", 0, 0 },
|
||||
{ NET_FLOAT, "Float", 0, 0 },
|
||||
{ NET_ANGLE, "Angle", -360, 360 },
|
||||
{ NET_SCALE, "Scale", 0, 0 },
|
||||
{ NET_COORD, "Coord", -262140, 262140 },
|
||||
{ NET_COLOR, "Color", 0, 255 },
|
||||
};
|
||||
|
||||
/*
|
||||
==========================================================
|
||||
|
||||
|
@ -72,6 +120,10 @@ typedef enum
|
|||
#define MAX_ITEMS 128 // player items
|
||||
#define MAX_GENERAL (MAX_CLIENTS * 2) // general config strings
|
||||
|
||||
#define ES_FIELD(x) #x,(int)&((entity_state_t*)0)->x
|
||||
#define PS_FIELD(x) #x,(int)&((player_state_t*)0)->x
|
||||
#define CM_FIELD(x) #x,(int)&((usercmd_t*)0)->x
|
||||
|
||||
// config strings are a general means of communication from
|
||||
// the server to all connected clients.
|
||||
// each config string can be at most MAX_QPATH characters.
|
||||
|
@ -102,6 +154,104 @@ typedef enum
|
|||
#define SND_POS (1<<2) // three coordinates
|
||||
#define SND_ENT (1<<3) // a short 0 - 2: channel, 3 - 12: entity
|
||||
|
||||
static net_field_t ent_fields[] =
|
||||
{
|
||||
{ ES_FIELD(origin[0]), NET_FLOAT, false },
|
||||
{ ES_FIELD(origin[1]), NET_FLOAT, false },
|
||||
{ ES_FIELD(origin[2]), NET_FLOAT, false },
|
||||
{ ES_FIELD(angles[0]), NET_FLOAT, false },
|
||||
{ ES_FIELD(angles[1]), NET_FLOAT, false },
|
||||
{ ES_FIELD(angles[2]), NET_FLOAT, false },
|
||||
{ ES_FIELD(old_origin[0]), NET_FLOAT, true },
|
||||
{ ES_FIELD(old_origin[1]), NET_FLOAT, true },
|
||||
{ ES_FIELD(old_origin[2]), NET_FLOAT, true },
|
||||
{ ES_FIELD(modelindex), NET_WORD, false }, // 4096 models
|
||||
{ ES_FIELD(soundindex), NET_WORD, false }, // 512 sounds ( OpenAL software limit is 255 )
|
||||
{ ES_FIELD(weaponmodel), NET_WORD, false }, // 4096 models
|
||||
{ ES_FIELD(skin), NET_BYTE, false }, // 255 skins
|
||||
{ ES_FIELD(frame), NET_FLOAT, false }, // interpolate value
|
||||
{ ES_FIELD(body), NET_BYTE, false }, // 255 bodies
|
||||
{ ES_FIELD(sequence), NET_WORD, false }, // 1024 sequences
|
||||
{ ES_FIELD(effects), NET_LONG, false }, // effect flags
|
||||
{ ES_FIELD(renderfx), NET_LONG, false }, // renderfx flags
|
||||
{ ES_FIELD(solid), NET_LONG, false }, // encoded mins/maxs
|
||||
{ ES_FIELD(alpha), NET_FLOAT, false }, // alpha value (FIXME: send a byte ? )
|
||||
{ ES_FIELD(animtime), NET_FLOAT, false }, // auto-animating time
|
||||
{ NULL }, // terminator
|
||||
};
|
||||
|
||||
static net_field_t ps_fields[] =
|
||||
{
|
||||
{ PS_FIELD(pm_type), NET_BYTE, false }, // 16 player movetypes allowed
|
||||
{ PS_FIELD(pm_flags), NET_WORD, true }, // 16 movetype flags allowed
|
||||
{ PS_FIELD(pm_time), NET_BYTE, true }, // each unit 8 msec
|
||||
#ifdef USE_COORD_FRAC
|
||||
{ PS_FIELD(origin[0]), NET_COORD, false },
|
||||
{ PS_FIELD(origin[1]), NET_COORD, false },
|
||||
{ PS_FIELD(origin[2]), NET_COORD, false },
|
||||
{ PS_FIELD(velocity[0]), NET_COORD, false },
|
||||
{ PS_FIELD(velocity[1]), NET_COORD, false },
|
||||
{ PS_FIELD(velocity[2]), NET_COORD, false },
|
||||
#else
|
||||
{ PS_FIELD(origin[0]), NET_FLOAT, false },
|
||||
{ PS_FIELD(origin[1]), NET_FLOAT, false },
|
||||
{ PS_FIELD(origin[2]), NET_FLOAT, false },
|
||||
{ PS_FIELD(velocity[0]), NET_FLOAT, false },
|
||||
{ PS_FIELD(velocity[1]), NET_FLOAT, false },
|
||||
{ PS_FIELD(velocity[2]), NET_FLOAT, false },
|
||||
#endif
|
||||
{ PS_FIELD(delta_angles[0]), NET_FLOAT, false },
|
||||
{ PS_FIELD(delta_angles[1]), NET_FLOAT, false },
|
||||
{ PS_FIELD(delta_angles[2]), NET_FLOAT, false },
|
||||
{ PS_FIELD(gravity), NET_SHORT, false }, // may be 12 bits ?
|
||||
{ PS_FIELD(effects), NET_LONG, false }, // copied to entity_state_t->effects
|
||||
{ PS_FIELD(viewangles[0]), NET_FLOAT, false }, // for fixed views
|
||||
{ PS_FIELD(viewangles[1]), NET_FLOAT, false },
|
||||
{ PS_FIELD(viewangles[2]), NET_FLOAT, false },
|
||||
{ PS_FIELD(viewoffset[0]), NET_SCALE, false }, // get rid of this
|
||||
{ PS_FIELD(viewoffset[1]), NET_SCALE, false },
|
||||
{ PS_FIELD(viewoffset[2]), NET_SCALE, false },
|
||||
{ PS_FIELD(kick_angles[0]), NET_SCALE, false },
|
||||
{ PS_FIELD(kick_angles[1]), NET_SCALE, false },
|
||||
{ PS_FIELD(kick_angles[2]), NET_SCALE, false },
|
||||
{ PS_FIELD(blend[0]), NET_COLOR, false }, // FIXME: calc on client, don't send over the net
|
||||
{ PS_FIELD(blend[1]), NET_COLOR, false },
|
||||
{ PS_FIELD(blend[2]), NET_COLOR, false },
|
||||
{ PS_FIELD(blend[3]), NET_COLOR, false },
|
||||
{ PS_FIELD(fov), NET_FLOAT, false }, // FIXME: send as byte * 4 ?
|
||||
{ PS_FIELD(vmodel.index), NET_WORD, false }, // 4096 models
|
||||
{ PS_FIELD(vmodel.angles[0]), NET_SCALE, false }, // can be some different with viewangles
|
||||
{ PS_FIELD(vmodel.angles[1]), NET_SCALE, false },
|
||||
{ PS_FIELD(vmodel.angles[2]), NET_SCALE, false },
|
||||
{ PS_FIELD(vmodel.offset[0]), NET_SCALE, false }, // center offset
|
||||
{ PS_FIELD(vmodel.offset[1]), NET_SCALE, false },
|
||||
{ PS_FIELD(vmodel.offset[2]), NET_SCALE, false },
|
||||
{ PS_FIELD(vmodel.sequence), NET_WORD, false }, // 1024 sequences
|
||||
{ PS_FIELD(vmodel.frame), NET_FLOAT, false }, // interpolate value
|
||||
{ PS_FIELD(vmodel.body), NET_BYTE, false }, // 255 bodies
|
||||
{ PS_FIELD(vmodel.skin), NET_BYTE, false }, // 255 skins
|
||||
{ PS_FIELD(pmodel.index), NET_WORD, false }, // 4096 models
|
||||
{ PS_FIELD(pmodel.sequence), NET_WORD, false }, // 1024 sequences
|
||||
{ PS_FIELD(vmodel.frame), NET_FLOAT, false }, // interpolate value
|
||||
{ NULL }, // terminator
|
||||
};
|
||||
|
||||
// probably usercmd_t never reached 32 field integer limit (in theory of course)
|
||||
static net_field_t cmd_fields[] =
|
||||
{
|
||||
{ CM_FIELD(msec), NET_BYTE, true },
|
||||
{ CM_FIELD(angles[0]), NET_WORD, false },
|
||||
{ CM_FIELD(angles[1]), NET_WORD, false },
|
||||
{ CM_FIELD(angles[2]), NET_WORD, false },
|
||||
{ CM_FIELD(forwardmove), NET_SHORT, false },
|
||||
{ CM_FIELD(sidemove), NET_SHORT, false },
|
||||
{ CM_FIELD(upmove), NET_SHORT, false },
|
||||
{ CM_FIELD(buttons), NET_BYTE, false },
|
||||
{ CM_FIELD(impulse), NET_BYTE, false },
|
||||
{ CM_FIELD(lightlevel), NET_BYTE, false },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ BSC32=bscmake.exe
|
|||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386
|
||||
# ADD LINK32 winmm.lib user32.lib msvcrt.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrtd.lib" /pdbtype:sept
|
||||
# ADD LINK32 winmm.lib user32.lib msvcrtd.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /incremental:no /map /nodefaultlib
|
||||
# Begin Custom Build
|
||||
TargetDir=\Xash3D\src_main\temp\engine\!debug
|
||||
|
@ -114,10 +114,6 @@ SOURCE="$(InputPath)"
|
|||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_cin.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_cmds.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -174,6 +170,10 @@ SOURCE=.\client\cl_tent.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_video.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\client\cl_view.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -650,8 +650,8 @@ Host_Error
|
|||
*/
|
||||
void Host_Error( const char *error, ... )
|
||||
{
|
||||
static char hosterror1[MAX_INPUTLINE];
|
||||
static char hosterror2[MAX_INPUTLINE];
|
||||
static char hosterror1[MAX_MSGLEN];
|
||||
static char hosterror2[MAX_MSGLEN];
|
||||
static bool recursive = false;
|
||||
va_list argptr;
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define SERVER_H
|
||||
|
||||
#include "mathlib.h"
|
||||
#include "basefiles.h"
|
||||
#include "sv_edict.h"
|
||||
|
||||
//=============================================================================
|
||||
|
@ -169,8 +168,8 @@ typedef struct
|
|||
bool initialized; // sv_init has completed
|
||||
dword realtime; // always increasing, no clamping, etc
|
||||
|
||||
char mapcmd[MAX_TOKEN_CHARS]; // ie: *intro.cin+base
|
||||
char comment[MAX_TOKEN_CHARS]; // map name, e.t.c.
|
||||
string mapcmd; // ie: *intro.cin+base
|
||||
string comment; // map name, e.t.c.
|
||||
|
||||
int spawncount; // incremented each server start
|
||||
// used to check late spawns
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "server.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
sv_client_t *sv_client; // current client
|
||||
|
||||
|
@ -18,7 +19,7 @@ Sends text across to be displayed if the level passes
|
|||
void SV_ClientPrintf( sv_client_t *cl, int level, char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
char string[MAX_STRING_CHARS];
|
||||
char string[MAX_SYSPATH];
|
||||
|
||||
if( level < cl->messagelevel )
|
||||
return;
|
||||
|
@ -41,7 +42,7 @@ Sends text to all active clients
|
|||
*/
|
||||
void SV_BroadcastPrintf( int level, char *fmt, ... )
|
||||
{
|
||||
char string[MAX_STRING_CHARS];
|
||||
char string[MAX_SYSPATH];
|
||||
va_list argptr;
|
||||
sv_client_t *cl;
|
||||
int i;
|
||||
|
@ -74,7 +75,7 @@ Sends text to all active clients
|
|||
void SV_BroadcastCommand( char *fmt, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
char string[MAX_STRING_CHARS];
|
||||
char string[MAX_SYSPATH];
|
||||
|
||||
if( !sv.state ) return;
|
||||
va_start( argptr, fmt );
|
||||
|
@ -233,7 +234,7 @@ void SV_Movie_f( void )
|
|||
return;
|
||||
}
|
||||
|
||||
com.snprintf( filename, MAX_QPATH, "%s.roq", Cmd_Argv(1));
|
||||
com.snprintf( filename, MAX_QPATH, "%s.dpv", Cmd_Argv(1));
|
||||
if(!FS_FileExists(va("video/%s", filename )))
|
||||
{
|
||||
Msg("Can't loading %s\n", filename );
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "common.h"
|
||||
#include "server.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
byte *sav_base;
|
||||
|
||||
|
@ -248,7 +249,7 @@ static void Cvar_AddToBuffer( const char *name, const char *string, const char *
|
|||
void SV_AddCvarLump( dsavehdr_t *hdr, file_t *f )
|
||||
{
|
||||
int bufsize = 1; // null terminator
|
||||
char *cvbuffer = Z_Malloc( MAX_INPUTLINE );
|
||||
char *cvbuffer = Z_Malloc( MAX_MSGLEN );
|
||||
|
||||
Cvar_LookupVars( CVAR_LATCH, cvbuffer, &bufsize, Cvar_AddToBuffer );
|
||||
SV_AddSaveLump( hdr, f, LUMP_GAMECVARS, cvbuffer, bufsize );
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include "basetypes.h"
|
||||
#include "stdapi.h"
|
||||
#include "stdref.h"
|
||||
#include "basefiles.h"
|
||||
#include "dllapi.h"
|
||||
#include "ref_dllapi.h"
|
||||
|
||||
#define IMAGE_MAXWIDTH 4096
|
||||
#define IMAGE_MAXHEIGHT 4096
|
||||
|
@ -37,14 +34,14 @@ byte *Image_ResampleInternal( const void *indata, int inwidth, int inheight, int
|
|||
bool Image_Resample( const char *name, rgbdata_t **image, int width, int height, bool free_baseimage );
|
||||
void Image_FreeImage( rgbdata_t *pack );
|
||||
void Image_Save( const char *filename, rgbdata_t *pix );
|
||||
rgbdata_t *Image_Load(const char *filename, char *buffer, int buffsize );
|
||||
rgbdata_t *Image_Load(const char *filename, const byte *buffer, size_t buffsize );
|
||||
|
||||
//
|
||||
// formats
|
||||
//
|
||||
bool Image_LoadTGA( const char *name, byte *buffer, size_t filesize );
|
||||
bool Image_LoadTGA( const char *name, const byte *buffer, size_t filesize );
|
||||
bool Image_SaveTGA( const char *name, rgbdata_t *pix, int saveformat);
|
||||
bool Image_LoadDDS( const char *name, byte *buffer, size_t filesize );
|
||||
bool Image_LoadDDS( const char *name, const byte *buffer, size_t filesize );
|
||||
bool Image_SaveDDS( const char *name, rgbdata_t *pix, int saveformat);
|
||||
|
||||
//
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "imagelib.h"
|
||||
#include "byteorder.h"
|
||||
#include "img_formats.h"
|
||||
|
||||
// TODO: tune this ?
|
||||
|
@ -1745,11 +1746,11 @@ uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
|||
Image_LoadDDS
|
||||
=============
|
||||
*/
|
||||
bool Image_LoadDDS( const char *name, byte *buffer, size_t filesize )
|
||||
bool Image_LoadDDS( const char *name, const byte *buffer, size_t filesize )
|
||||
{
|
||||
dds_t header;
|
||||
byte *fin;
|
||||
uint i;
|
||||
dds_t header;
|
||||
const byte *fin;
|
||||
uint i;
|
||||
|
||||
fin = buffer;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ typedef struct loadformat_s
|
|||
{
|
||||
char *formatstring;
|
||||
char *ext;
|
||||
bool (*loadfunc)( const char *name, byte *buffer, size_t filesize );
|
||||
bool (*loadfunc)( const char *name, const byte *buffer, size_t filesize );
|
||||
} loadformat_t;
|
||||
|
||||
loadformat_t load_formats[] =
|
||||
|
@ -117,7 +117,7 @@ FS_LoadImage
|
|||
loading and unpack to rgba any known image
|
||||
================
|
||||
*/
|
||||
rgbdata_t *Image_Load(const char *filename, char *buffer, int buffsize )
|
||||
rgbdata_t *Image_Load(const char *filename, const byte *buffer, size_t buffsize )
|
||||
{
|
||||
loadformat_t *format;
|
||||
const char *ext = FS_FileExtension( filename );
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "imagelib.h"
|
||||
#include "byteorder.h"
|
||||
#include "img_formats.h"
|
||||
|
||||
/*
|
||||
|
@ -11,7 +12,7 @@
|
|||
Image_LoadTGA
|
||||
=============
|
||||
*/
|
||||
bool Image_LoadTGA( const char *name, byte *buffer, size_t filesize )
|
||||
bool Image_LoadTGA( const char *name, const byte *buffer, size_t filesize )
|
||||
{
|
||||
int x, y, pix_inc, row_inc;
|
||||
int red, green, blue, alpha;
|
||||
|
|
|
@ -192,7 +192,7 @@ xash -nosound +cmd amlev1
|
|||
void Cmd_StuffCmds_f( void )
|
||||
{
|
||||
int i, j, l = 0;
|
||||
char build[MAX_INPUTLINE]; // this is for all commandline options combined (and is bounds checked)
|
||||
char build[MAX_MSGLEN]; // this is for all commandline options combined (and is bounds checked)
|
||||
|
||||
if(Cmd_Argc() != 1)
|
||||
{
|
||||
|
@ -340,7 +340,7 @@ typedef struct cmd_function_s
|
|||
|
||||
static int cmd_argc;
|
||||
static char *cmd_argv[MAX_STRING_TOKENS];
|
||||
static char cmd_tokenized[MAX_INPUTLINE+MAX_STRING_TOKENS]; // will have 0 bytes inserted
|
||||
static char cmd_tokenized[MAX_MSGLEN+MAX_STRING_TOKENS]; // will have 0 bytes inserted
|
||||
static cmd_function_t *cmd_functions; // possible commands to execute
|
||||
|
||||
/*
|
||||
|
@ -374,7 +374,7 @@ Returns a single string containing argv(1) to argv(argc()-1)
|
|||
*/
|
||||
char *Cmd_Args( void )
|
||||
{
|
||||
static char cmd_args[MAX_STRING_CHARS];
|
||||
static char cmd_args[MAX_SYSPATH];
|
||||
int i;
|
||||
|
||||
cmd_args[0] = 0;
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "launch.h"
|
||||
#include "zip32.h"
|
||||
#include "filesystem.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
#define ZIP_END_CDIR_SIZE 22
|
||||
#define ZIP_CDIR_CHUNK_BASE_SIZE 46
|
||||
|
@ -936,10 +937,10 @@ then loads and adds pak1.pak pak2.pak ...
|
|||
*/
|
||||
void FS_AddGameDirectory( const char *dir, int flags )
|
||||
{
|
||||
int i;
|
||||
stringlist_t list;
|
||||
searchpath_t *search;
|
||||
char pakfile[MAX_OSPATH];
|
||||
stringlist_t list;
|
||||
searchpath_t *search;
|
||||
string pakfile;
|
||||
int i;
|
||||
|
||||
com_strncpy (fs_gamedir, dir, sizeof (fs_gamedir));
|
||||
|
||||
|
@ -1643,7 +1644,7 @@ FS_SysOpen
|
|||
Internal function used to create a file_t and open the relevant non-packed file on disk
|
||||
====================
|
||||
*/
|
||||
static file_t* FS_SysOpen (const char* filepath, const char* mode, bool nonblocking)
|
||||
static file_t* FS_SysOpen (const char* filepath, const char* mode )
|
||||
{
|
||||
file_t* file;
|
||||
int mod, opt;
|
||||
|
@ -1682,7 +1683,6 @@ static file_t* FS_SysOpen (const char* filepath, const char* mode, bool nonblock
|
|||
Msg("FS_SysOpen(%s, %s): unknown character in mode (%c)\n", filepath, mode, mode[ind]);
|
||||
}
|
||||
}
|
||||
if (nonblocking) opt |= O_NONBLOCK;
|
||||
|
||||
file = (file_t *)Mem_Alloc (fs_mempool, sizeof (*file));
|
||||
memset (file, 0, sizeof (*file));
|
||||
|
@ -1870,7 +1870,7 @@ FS_OpenReadFile
|
|||
Look for a file in the search paths and open it in read-only mode
|
||||
===========
|
||||
*/
|
||||
file_t *FS_OpenReadFile (const char *filename, const char *mode, bool quiet, bool nonblocking)
|
||||
file_t *FS_OpenReadFile( const char *filename, const char *mode, bool quiet )
|
||||
{
|
||||
searchpath_t *search;
|
||||
int pack_ind;
|
||||
|
@ -1885,7 +1885,7 @@ file_t *FS_OpenReadFile (const char *filename, const char *mode, bool quiet, boo
|
|||
{
|
||||
char path [MAX_SYSPATH];
|
||||
com_sprintf (path, "%s%s", search->filename, filename);
|
||||
return FS_SysOpen (path, mode, nonblocking);
|
||||
return FS_SysOpen( path, mode );
|
||||
}
|
||||
|
||||
// So, we found it in a package...
|
||||
|
@ -2046,7 +2046,7 @@ FS_Open
|
|||
Open a file. The syntax is the same as fopen
|
||||
====================
|
||||
*/
|
||||
file_t* _FS_Open (const char* filepath, const char* mode, bool quiet, bool nonblocking)
|
||||
file_t* _FS_Open( const char* filepath, const char* mode, bool quiet )
|
||||
{
|
||||
if (FS_CheckNastyPath(filepath, false))
|
||||
{
|
||||
|
@ -2062,16 +2062,16 @@ file_t* _FS_Open (const char* filepath, const char* mode, bool quiet, bool nonbl
|
|||
// Open the file on disk directly
|
||||
com_sprintf (real_path, "%s/%s", fs_gamedir, filepath);
|
||||
FS_CreatePath (real_path);// Create directories up to the file
|
||||
return FS_SysOpen (real_path, mode, nonblocking);
|
||||
return FS_SysOpen (real_path, mode );
|
||||
}
|
||||
|
||||
// Else, we look at the various search paths and open the file in read-only mode
|
||||
return FS_OpenReadFile (filepath, mode, quiet, nonblocking);
|
||||
return FS_OpenReadFile( filepath, mode, quiet );
|
||||
}
|
||||
|
||||
file_t* FS_Open (const char* filepath, const char* mode )
|
||||
{
|
||||
return _FS_Open (filepath, mode, true, false );
|
||||
return _FS_Open (filepath, mode, true );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2334,7 +2334,7 @@ Print a string into a file
|
|||
int FS_VPrintf (file_t* file, const char* format, va_list ap)
|
||||
{
|
||||
int len;
|
||||
fs_offset_t buff_size = MAX_INPUTLINE;
|
||||
fs_offset_t buff_size = MAX_MSGLEN;
|
||||
char *tempbuff;
|
||||
|
||||
while( true )
|
||||
|
@ -2553,7 +2553,7 @@ byte *FS_LoadFile (const char *path, fs_offset_t *filesizeptr )
|
|||
fs_offset_t filesize = 0;
|
||||
const char *ext = FS_FileExtension( path );
|
||||
|
||||
file = _FS_Open (path, "rb", true, false);
|
||||
file = _FS_Open( path, "rb", true );
|
||||
if (file)
|
||||
{
|
||||
filesize = file->real_length;
|
||||
|
@ -2580,7 +2580,7 @@ bool FS_WriteFile (const char *filename, const void *data, fs_offset_t len)
|
|||
{
|
||||
file_t *file;
|
||||
|
||||
file = _FS_Open (filename, "wb", false, false);
|
||||
file = _FS_Open( filename, "wb", false );
|
||||
if (!file)
|
||||
{
|
||||
MsgDev( D_ERROR, "FS_WriteFile: failed on %s\n", filename);
|
||||
|
@ -2700,7 +2700,7 @@ fs_offset_t FS_FileSize (const char *filename)
|
|||
file_t *fp;
|
||||
int length = 0;
|
||||
|
||||
fp = _FS_Open(filename, "rb", true, false );
|
||||
fp = _FS_Open( filename, "rb", true );
|
||||
|
||||
if (fp)
|
||||
{
|
||||
|
@ -2739,16 +2739,15 @@ Allocate and fill a search structure with information on matching filenames.
|
|||
*/
|
||||
static search_t *_FS_Search( const char *pattern, int caseinsensitive, int quiet )
|
||||
{
|
||||
search_t *search = NULL;
|
||||
searchpath_t *searchpath;
|
||||
pack_t *pak;
|
||||
int i, k, basepathlength, numfiles, numchars, resultlistindex, dirlistindex;
|
||||
stringlist_t resultlist;
|
||||
stringlist_t dirlist;
|
||||
const char *slash, *backslash, *colon, *separator;
|
||||
char *basepath;
|
||||
char netpath[MAX_OSPATH];
|
||||
char temp[MAX_OSPATH];
|
||||
search_t *search = NULL;
|
||||
searchpath_t *searchpath;
|
||||
pack_t *pak;
|
||||
int i, k, basepathlength, numfiles, numchars, resultlistindex, dirlistindex;
|
||||
stringlist_t resultlist;
|
||||
stringlist_t dirlist;
|
||||
const char *slash, *backslash, *colon, *separator;
|
||||
char *basepath;
|
||||
string netpath, temp;
|
||||
|
||||
for( i = 0; pattern[i] == '.' || pattern[i] == ':' || pattern[i] == '/' || pattern[i] == '\\'; i++ );
|
||||
|
||||
|
@ -3165,7 +3164,7 @@ Print a string into a buffer
|
|||
int VFS_VPrintf(vfile_t* file, const char* format, va_list ap)
|
||||
{
|
||||
int len;
|
||||
fs_offset_t buff_size = MAX_INPUTLINE;
|
||||
fs_offset_t buff_size = MAX_MSGLEN;
|
||||
char *tempbuff;
|
||||
|
||||
while( true )
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
//=======================================================================
|
||||
// Copyright (C) XashXT Group 2006
|
||||
// All Rights Reserved
|
||||
// zip32.h - zlib custom build
|
||||
//=======================================================================
|
||||
#ifndef COM_ZLIB_H
|
||||
#define COM_ZLIB_H
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
PAK FILES
|
||||
|
||||
The .pak files are just a linear collapse of a directory tree
|
||||
========================================================================
|
||||
*/
|
||||
// header
|
||||
#define IDPACKV1HEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P') // little-endian "PACK"
|
||||
#define IDPACKV2HEADER (('2'<<24)+('K'<<16)+('A'<<8)+'P') // little-endian "PAK2"
|
||||
#define IDPACKV3HEADER (('\4'<<24)+('\3'<<16)+('K'<<8)+'P') // little-endian "PK\3\4"
|
||||
#define IDPK3CDRHEADER (('\2'<<24)+('\1'<<16)+('K'<<8)+'P') // little-endian "PK\1\2"
|
||||
#define IDPK3ENDHEADER (('\6'<<24)+('\5'<<16)+('K'<<8)+'P') // little-endian "PK\5\6"
|
||||
|
||||
#define MAX_FILES_IN_PACK 65536 // pack\pak2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int dirofs;
|
||||
int dirlen;
|
||||
} dpackheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[56]; // total 64 bytes
|
||||
int filepos;
|
||||
int filelen;
|
||||
} dpackfile_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[116]; // total 128 bytes
|
||||
int filepos;
|
||||
int filelen;
|
||||
uint attribs; // file attributes
|
||||
} dpak2file_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
word disknum;
|
||||
word cdir_disknum; // number of the disk with the start of the central directory
|
||||
word localentries; // number of entries in the central directory on this disk
|
||||
word nbentries; // total number of entries in the central directory on this disk
|
||||
uint cdir_size; // size of the central directory
|
||||
uint cdir_offset; // with respect to the starting disk number
|
||||
word comment_size;
|
||||
} dpak3file_t;
|
||||
|
||||
#define ZLIB_VERSION "1.2.3"
|
||||
#define MAX_WBITS 15
|
||||
|
||||
// zlib errors
|
||||
#define Z_OK 0
|
||||
#define Z_STREAM_END 1
|
||||
#define Z_SYNC_FLUSH 2
|
||||
#define Z_FINISH 4
|
||||
|
||||
typedef struct z_stream_s
|
||||
{
|
||||
byte *next_in; // next input byte
|
||||
uint avail_in; // number of bytes available at next_in
|
||||
dword total_in; // total nb of input bytes read so far
|
||||
byte *next_out; // next output byte should be put there
|
||||
uint avail_out; // remaining free space at next_out
|
||||
dword total_out; // total nb of bytes output so far
|
||||
char *msg; // last error message, NULL if no error
|
||||
byte *state; // not visible by applications
|
||||
byte* (*zalloc)(); // used to allocate the internal state
|
||||
void (*zfree)(); // used to free the internal state
|
||||
byte* opaque; // private data object passed to zalloc and zfree
|
||||
int data_type; // best guess about the data type: binary or text
|
||||
dword adler; // adler32 value of the uncompressed data
|
||||
dword reserved; // reserved for future use
|
||||
} z_stream;
|
||||
|
||||
// exported functions
|
||||
extern int inflate(z_stream *strm, int flush);
|
||||
extern int inflateEnd(z_stream *strm);
|
||||
extern int inflateInit_(z_stream *strm, const char *version, int stream_size);
|
||||
extern int inflateInit2_(z_stream *strm, int windowBits, const char *version, int stream_size);
|
||||
extern int inflateReset(z_stream *strm);
|
||||
extern int deflate (z_stream *strm, int flush);
|
||||
extern int deflateEnd (z_stream *strm);
|
||||
extern int deflateInit_(z_stream *strm, int level, const char *version, int stream_size);
|
||||
extern int deflateInit2_ (z_stream *strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size);
|
||||
extern int deflateReset (z_stream *strm);
|
||||
|
||||
#define inflateInit(strm) inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
|
||||
#define inflateInit2(strm, windowBits) inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
|
||||
#define deflateInit(strm, level) deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
|
||||
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) deflateInit2_((strm),(level),(method),(windowBits),(memLevel),(strategy), ZLIB_VERSION, sizeof(z_stream))
|
||||
|
||||
#endif//COM_ZLIB_H
|
|
@ -6,6 +6,7 @@
|
|||
#include <winsock.h>
|
||||
#include <wsipx.h>
|
||||
#include "launch.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
#define MAX_IPS 16
|
||||
#define PORT_ANY -1
|
||||
|
@ -214,7 +215,7 @@ bool NET_StringToSockaddr( const char *s, struct sockaddr *sadr )
|
|||
{
|
||||
struct hostent *h;
|
||||
int val;
|
||||
char copy[MAX_STRING_CHARS];
|
||||
char copy[MAX_SYSPATH];
|
||||
|
||||
memset( sadr, 0, sizeof( *sadr ) );
|
||||
// check for an IPX address
|
||||
|
|
|
@ -21,7 +21,7 @@ script_t scriptstack[ MAX_INCLUDES ];
|
|||
script_t *script;
|
||||
int scriptline;
|
||||
|
||||
char token[ MAX_INPUTLINE ]; //contains token info
|
||||
char token[MAX_MSGLEN]; //contains token info
|
||||
|
||||
bool endofscript;
|
||||
bool tokenready; // only true if UnGetToken was just called
|
||||
|
@ -852,7 +852,7 @@ SC_FilterToken
|
|||
*/
|
||||
bool SC_FilterToken(char *filter, char *name, int casecmp)
|
||||
{
|
||||
char buf[MAX_INPUTLINE];
|
||||
char buf[MAX_MSGLEN];
|
||||
char *ptr;
|
||||
int i, found;
|
||||
|
||||
|
|
|
@ -578,8 +578,8 @@ print into window console
|
|||
void Sys_Print(const char *pMsg)
|
||||
{
|
||||
const char *msg;
|
||||
char buffer[MAX_INPUTLINE * 8];
|
||||
char logbuf[MAX_INPUTLINE * 8];
|
||||
char buffer[MAX_MSGLEN * 4];
|
||||
char logbuf[MAX_MSGLEN * 4];
|
||||
char *b = buffer;
|
||||
char *c = logbuf;
|
||||
int i = 0;
|
||||
|
@ -588,8 +588,8 @@ void Sys_Print(const char *pMsg)
|
|||
if(Sys.CPrint) Sys.CPrint( pMsg );
|
||||
|
||||
// if the message is REALLY long, use just the last portion of it
|
||||
if ( com_strlen( pMsg ) > MAX_INPUTLINE - 1 )
|
||||
msg = pMsg + com_strlen( pMsg ) - MAX_INPUTLINE + 1;
|
||||
if ( com_strlen( pMsg ) > MAX_MSGLEN - 1 )
|
||||
msg = pMsg + com_strlen( pMsg ) - MAX_MSGLEN + 1;
|
||||
else msg = pMsg;
|
||||
|
||||
// copy into an intermediate buffer
|
||||
|
@ -642,7 +642,7 @@ formatted message
|
|||
void Sys_Msg( const char *pMsg, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
char text[MAX_INPUTLINE];
|
||||
char text[MAX_MSGLEN];
|
||||
|
||||
va_start (argptr, pMsg);
|
||||
com_vsprintf (text, pMsg, argptr);
|
||||
|
@ -654,7 +654,7 @@ void Sys_Msg( const char *pMsg, ... )
|
|||
void Sys_MsgDev( int level, const char *pMsg, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
char text[MAX_INPUTLINE];
|
||||
char text[MAX_MSGLEN];
|
||||
|
||||
if(Sys.developer < level) return;
|
||||
|
||||
|
@ -847,7 +847,7 @@ before call this
|
|||
void Sys_Error(const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[MAX_INPUTLINE];
|
||||
char text[MAX_MSGLEN];
|
||||
|
||||
if( Sys.app_state == SYS_ERROR )
|
||||
return; // don't multiple executes
|
||||
|
@ -869,7 +869,7 @@ void Sys_Error(const char *error, ...)
|
|||
void Sys_Break(const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[MAX_INPUTLINE];
|
||||
char text[MAX_MSGLEN];
|
||||
|
||||
va_start (argptr, error);
|
||||
com_vsprintf (text, error, argptr);
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
#define LAUNCH_DLL // skip alias names
|
||||
#include "basetypes.h"
|
||||
#include "stdapi.h"
|
||||
#include "stdref.h"
|
||||
#include "basefiles.h"
|
||||
#include "dllapi.h"
|
||||
#include "ref_dllapi.h"
|
||||
|
||||
#define XASH_VERSION 0.51f // current version will be shared across gameinfo struct
|
||||
|
||||
#define MAX_NUM_ARGVS 128
|
||||
#define MAX_STRING_TOKENS 80
|
||||
|
||||
enum state_e
|
||||
{
|
||||
SYS_SHUTDOWN = 0,
|
||||
|
@ -286,8 +286,8 @@ search_t *FS_Search(const char *pattern, int caseinsensitive );
|
|||
search_t *FS_SearchDirs(const char *pattern, int caseinsensitive );
|
||||
|
||||
// files managment (like fopen, fread etc)
|
||||
file_t *FS_Open (const char* filepath, const char* mode );
|
||||
file_t* _FS_Open (const char* filepath, const char* mode, bool quiet, bool nonblocking);
|
||||
file_t *FS_Open( const char* filepath, const char* mode );
|
||||
file_t* _FS_Open( const char* filepath, const char* mode, bool quiet );
|
||||
fs_offset_t FS_Write (file_t* file, const void* data, size_t datasize);
|
||||
fs_offset_t FS_Read (file_t* file, void* buffer, size_t buffersize);
|
||||
int FS_VPrintf(file_t* file, const char* format, va_list ap);
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
#define CM_LOCAL_H
|
||||
|
||||
#include "physic.h"
|
||||
#include "basefiles.h"
|
||||
#include "mathlib.h"
|
||||
#include "cm_utils.h"
|
||||
|
||||
#define MAX_MATERIALS 64
|
||||
#define CAPSULE_MODEL_HANDLE MAX_MODELS - 2
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "cm_local.h"
|
||||
#include "basefiles.h"
|
||||
|
||||
clipmap_t cm;
|
||||
studio_t studio;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "cm_local.h"
|
||||
#include "basefiles.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "physic.h"
|
||||
#include "mathlib.h"
|
||||
#include "cm_utils.h"
|
||||
|
||||
physbody_t *Phys_CreateBody( sv_edict_t *ed, cmodel_t *mod, matrix4x3 transform, int solid )
|
||||
{
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef CM_UTILS_H
|
||||
#define CM_UTILS_H
|
||||
|
||||
#include "byteorder.h"
|
||||
|
||||
_inline void CM_ConvertPositionToMeters( vec3_t out, vec3_t in )
|
||||
{
|
||||
out[0] = LittleFloat(INCH2METER(in[0]));
|
||||
|
|
|
@ -8,12 +8,7 @@
|
|||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include "basetypes.h"
|
||||
#include "stdapi.h"
|
||||
#include "stdref.h"
|
||||
#include "basefiles.h"
|
||||
#include "dllapi.h"
|
||||
#include "mathlib.h"
|
||||
#include "cm_utils.h"
|
||||
#include "ref_dllapi.h"
|
||||
|
||||
typedef struct physbody_s NewtonBody;
|
||||
typedef struct physworld_s NewtonWorld;
|
||||
|
|
|
@ -1,634 +0,0 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// basefiles.h - xash supported formats
|
||||
//=======================================================================
|
||||
#ifndef BASE_FILES_H
|
||||
#define BASE_FILES_H
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
SPRITE MODELS
|
||||
|
||||
.spr extended version (non-paletted 32-bit sprites with zlib-compression for each frame)
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#define IDSPRITEHEADER (('R'<<24)+('P'<<16)+('S'<<8)+'I') // little-endian "ISPR"
|
||||
#define SPRITE_VERSION 3
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPR_STATIC = 0,
|
||||
SPR_BOUNCE,
|
||||
SPR_GRAVITY,
|
||||
SPR_FLYING
|
||||
} phystype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPR_SINGLE = 0,
|
||||
SPR_GROUP,
|
||||
SPR_ANGLED
|
||||
} frametype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPR_SOLID = 0,
|
||||
SPR_ADDITIVE,
|
||||
SPR_GLOW,
|
||||
SPR_ALPHA
|
||||
} drawtype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPR_FWD_PARALLEL_UPRIGHT = 0,
|
||||
SPR_FACING_UPRIGHT,
|
||||
SPR_FWD_PARALLEL,
|
||||
SPR_ORIENTED,
|
||||
SPR_FWD_PARALLEL_ORIENTED
|
||||
} angletype_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident; // LittleLong 'ISPR'
|
||||
int version; // current version 3
|
||||
angletype_t type; // camera align
|
||||
drawtype_t rendermode; // rendering mode
|
||||
int bounds[2]; // minmaxs
|
||||
int numframes; // including groups
|
||||
phystype_t movetype; // particle physic
|
||||
float scale; // initial scale
|
||||
} dsprite_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int origin[2];
|
||||
int width;
|
||||
int height;
|
||||
int compsize;
|
||||
} dframe_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numframes;
|
||||
} dspritegroup_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float interval;
|
||||
} dspriteinterval_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
frametype_t type;
|
||||
} dframetype_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
BRUSH MODELS
|
||||
|
||||
.bsp contain level static geometry with including PVS, PHS, PHYS and lightning info
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
// header
|
||||
#define BSPMOD_VERSION 39
|
||||
#define IDBSPMODHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I') // little-endian "IBSP"
|
||||
|
||||
// 32 bit limits
|
||||
#define MAX_KEY 128
|
||||
#define MAX_VALUE 512
|
||||
#define MAX_MAP_AREAS 0x100 // don't increase this
|
||||
#define MAX_MAP_MODELS 0x2000 // mesh models and sprites too
|
||||
#define MAX_MAP_AREAPORTALS 0x400
|
||||
#define MAX_MAP_ENTITIES 0x2000
|
||||
#define MAX_MAP_TEXINFO 0x2000
|
||||
#define MAX_MAP_BRUSHES 0x8000
|
||||
#define MAX_MAP_PLANES 0x20000
|
||||
#define MAX_MAP_NODES 0x20000
|
||||
#define MAX_MAP_BRUSHSIDES 0x20000
|
||||
#define MAX_MAP_LEAFS 0x20000
|
||||
#define MAX_MAP_VERTS 0x80000
|
||||
#define MAX_MAP_FACES 0x20000
|
||||
#define MAX_MAP_LEAFFACES 0x20000
|
||||
#define MAX_MAP_LEAFBRUSHES 0x40000
|
||||
#define MAX_MAP_PORTALS 0x20000
|
||||
#define MAX_MAP_EDGES 0x80000
|
||||
#define MAX_MAP_SURFEDGES 0x80000
|
||||
#define MAX_MAP_ENTSTRING 0x80000
|
||||
#define MAX_MAP_LIGHTING 0x800000
|
||||
#define MAX_MAP_VISIBILITY 0x800000
|
||||
#define MAX_MAP_COLLISION 0x800000
|
||||
#define MAX_MAP_STRINGDATA 0x40000
|
||||
#define MAX_MAP_NUMSTRINGS 0x10000
|
||||
|
||||
// game limits
|
||||
#define MAX_MODELS MAX_MAP_MODELS>>1 // brushmodels and other models
|
||||
#define MAX_WORLD_COORD ( 128 * 1024 )
|
||||
#define MIN_WORLD_COORD (-128 * 1024 )
|
||||
#define WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD )
|
||||
|
||||
// lump offset
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_PLANES 1
|
||||
#define LUMP_LEAFS 2
|
||||
#define LUMP_LEAFFACES 3
|
||||
#define LUMP_LEAFBRUSHES 4
|
||||
#define LUMP_NODES 5
|
||||
#define LUMP_VERTEXES 6
|
||||
#define LUMP_EDGES 7
|
||||
#define LUMP_SURFEDGES 8
|
||||
#define LUMP_SURFDESC 9
|
||||
#define LUMP_FACES 10
|
||||
#define LUMP_MODELS 11
|
||||
#define LUMP_BRUSHES 12
|
||||
#define LUMP_BRUSHSIDES 13
|
||||
#define LUMP_VISIBILITY 14
|
||||
#define LUMP_LIGHTING 15
|
||||
#define LUMP_COLLISION 16 // newton collision tree (worldmodel coords already convert to meters)
|
||||
#define LUMP_BVHSTATIC 17 // bullet collision tree (currently not used)
|
||||
#define LUMP_SVPROGS 18 // private server.dat for current map
|
||||
#define LUMP_WAYPOINTS 19 // AI navigate tree (like .aas file for quake3)
|
||||
#define LUMP_STRINGDATA 20 // string array
|
||||
#define LUMP_STRINGTABLE 21 // string table id's
|
||||
|
||||
// get rid of this
|
||||
#define LUMP_AREAS 22
|
||||
#define LUMP_AREAPORTALS 23
|
||||
|
||||
#define LUMP_TOTALCOUNT 32 // max lumps
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
//other limits
|
||||
#define MAXLIGHTMAPS 4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
lump_t lumps[LUMP_TOTALCOUNT];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float mins[3];
|
||||
float maxs[3];
|
||||
int headnode;
|
||||
int firstface; // submodels just draw faces
|
||||
int numfaces; // without walking the bsp tree
|
||||
int firstbrush; // physics stuff
|
||||
int numbrushes;
|
||||
} dmodel_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float point[3];
|
||||
} dvertex_t;
|
||||
|
||||
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];
|
||||
int firstface;
|
||||
int numfaces; // counting both sides
|
||||
} dnode_t;
|
||||
|
||||
typedef struct dsurfdesc_s
|
||||
{
|
||||
float vecs[2][4]; // [s/t][xyz offset] texture s\t
|
||||
int size[2]; // valid size for current s\t coords (used for replace texture)
|
||||
int texid; // string table texture id number
|
||||
int animid; // string table animchain id number
|
||||
int flags; // surface flags
|
||||
int value; // used by qrad, not engine
|
||||
} dsurfdesc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int v[2]; // vertex numbers
|
||||
} dedge_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int firstedge;
|
||||
int numedges;
|
||||
int desc;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
|
||||
// get rid of this
|
||||
short side;
|
||||
} dface_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int contents; // or of all brushes (not needed?)
|
||||
int cluster;
|
||||
int area;
|
||||
int mins[3]; // for frustum culling
|
||||
int maxs[3];
|
||||
int firstleafface;
|
||||
int numleaffaces;
|
||||
int firstleafbrush;
|
||||
int numleafbrushes;
|
||||
} dleaf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum; // facing out of the leaf
|
||||
int surfdesc; // surface description (s/t coords, flags, etc)
|
||||
} dbrushside_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int firstside;
|
||||
int numsides;
|
||||
int contents;
|
||||
} dbrush_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numclusters;
|
||||
int bitofs[8][2]; // bitofs[numclusters][2]
|
||||
} dvis_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int portalnum;
|
||||
int otherarea;
|
||||
} dareaportal_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numareaportals;
|
||||
int firstareaportal;
|
||||
} darea_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
VIRTUAL MACHINE
|
||||
|
||||
a internal virtual machine like as QuakeC, but it has more extensions
|
||||
==============================================================================
|
||||
*/
|
||||
// header
|
||||
#define QPROGS_VERSION 6 // Quake1 progs version
|
||||
#define FPROGS_VERSION 7 // Fte progs version
|
||||
#define VPROGS_VERSION 8 // xash progs version
|
||||
#define LNNUMS_VERSION 1 // line numbers version
|
||||
|
||||
#define VPROGSHEADER16 (('6'<<24)+('1'<<16)+('D'<<8)+'I') // little-endian "ID16"
|
||||
#define VPROGSHEADER32 (('2'<<24)+('3'<<16)+('D'<<8)+'I') // little-endian "ID32"
|
||||
#define LINENUMSHEADER (('F'<<24)+('O'<<16)+('N'<<8)+'L') // little-endian "LNOF"
|
||||
|
||||
#define PRVM_OP_STATE 1
|
||||
#define PRVM_FE_CHAIN 4
|
||||
#define PRVM_FE_CLASSNAME 8
|
||||
|
||||
enum
|
||||
{
|
||||
PRVM_SERVERPROG = 0,
|
||||
PRVM_CLIENTPROG,
|
||||
PRVM_MENUPROG,
|
||||
PRVM_DECOMPILED,
|
||||
PRVM_MAXPROGS, // must be last
|
||||
};
|
||||
|
||||
// global ofssets
|
||||
#define OFS_NULL 0
|
||||
#define OFS_RETURN 1
|
||||
#define OFS_PARM0 4
|
||||
#define OFS_PARM1 7
|
||||
#define OFS_PARM2 10
|
||||
#define OFS_PARM3 13
|
||||
#define OFS_PARM4 16
|
||||
#define OFS_PARM5 19
|
||||
#define OFS_PARM6 22
|
||||
#define OFS_PARM7 25
|
||||
#define RESERVED_OFS 28
|
||||
|
||||
// misc flags
|
||||
#define DEF_SHARED (1<<14)
|
||||
#define DEF_SAVEGLOBAL (1<<15)
|
||||
|
||||
// compression block flags
|
||||
#define COMP_STATEMENTS 1
|
||||
#define COMP_DEFS 2
|
||||
#define COMP_FIELDS 4
|
||||
#define COMP_FUNCTIONS 8
|
||||
#define COMP_STRINGS 16
|
||||
#define COMP_GLOBALS 32
|
||||
#define COMP_LINENUMS 64
|
||||
#define COMP_TYPES 128
|
||||
#define COMP_SOURCE 256
|
||||
#define MAX_PARMS 8
|
||||
|
||||
#define PRVM_MAX_STACK_DEPTH 1024
|
||||
#define PRVM_LOCALSTACK_SIZE 16384
|
||||
#define PRVM_MAX_OPENFILES 256
|
||||
#define PRVM_MAX_OPENSEARCHES 128
|
||||
|
||||
// 16-bit mode
|
||||
#define dstatement_t dstatement16_t
|
||||
#define ddef_t ddef16_t // these should be the same except the string type
|
||||
|
||||
typedef void (*prvm_builtin_t)( void );
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ev_void,
|
||||
ev_string,
|
||||
ev_float,
|
||||
ev_vector,
|
||||
ev_entity,
|
||||
ev_field,
|
||||
ev_function,
|
||||
ev_pointer,
|
||||
ev_integer,
|
||||
ev_variant,
|
||||
ev_struct,
|
||||
ev_union,
|
||||
ev_bool,
|
||||
} etype_t;
|
||||
|
||||
typedef struct statement16_s
|
||||
{
|
||||
word op;
|
||||
short a,b,c;
|
||||
|
||||
} dstatement16_t;
|
||||
|
||||
typedef struct statement32_s
|
||||
{
|
||||
dword op;
|
||||
long a,b,c;
|
||||
|
||||
} dstatement32_t;
|
||||
|
||||
typedef struct ddef16_s
|
||||
{
|
||||
word type; // if DEF_SAVEGLOBAL bit is set
|
||||
// the variable needs to be saved in savegames
|
||||
word ofs;
|
||||
string_t s_name;
|
||||
} ddef16_t;
|
||||
|
||||
typedef struct ddef32_s
|
||||
{
|
||||
dword type; // if DEF_SAVEGLOBAL bit is set
|
||||
// the variable needs to be saved in savegames
|
||||
dword ofs;
|
||||
string_t s_name;
|
||||
} ddef32_t;
|
||||
|
||||
typedef struct fdef_s
|
||||
{
|
||||
uint type; // if DEF_SAVEGLOBAL bit is set
|
||||
// the variable needs to be saved in savegames
|
||||
uint ofs;
|
||||
uint progsofs; // used at loading time, so maching field offsets (unions/members)
|
||||
// are positioned at the same runtime offset.
|
||||
char *name;
|
||||
} fdef_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int first_statement; // negative numbers are builtins
|
||||
int parm_start;
|
||||
int locals; // total ints of parms + locals
|
||||
int profile; // runtime
|
||||
string_t s_name;
|
||||
string_t s_file; // source file defined in
|
||||
int numparms;
|
||||
byte parm_size[MAX_PARMS];
|
||||
} dfunction_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version; // version number
|
||||
int crc; // check of header file
|
||||
|
||||
uint ofs_statements; // comp 1
|
||||
uint numstatements; // statement 0 is an error
|
||||
uint ofs_globaldefs; // comp 2
|
||||
uint numglobaldefs;
|
||||
uint ofs_fielddefs; // comp 4
|
||||
uint numfielddefs;
|
||||
uint ofs_functions; // comp 8
|
||||
uint numfunctions; // function 0 is an empty
|
||||
uint ofs_strings; // comp 16
|
||||
uint numstrings; // first string is a null string
|
||||
uint ofs_globals; // comp 32
|
||||
uint numglobals;
|
||||
uint entityfields;
|
||||
|
||||
// version 7 extensions
|
||||
uint ofsfiles; // source files always compressed
|
||||
uint ofslinenums; // numstatements big // comp 64
|
||||
uint ofsbodylessfuncs; // no comp
|
||||
uint numbodylessfuncs;
|
||||
uint ofs_types; // comp 128
|
||||
uint numtypes;
|
||||
uint blockscompressed; // who blocks are compressed (COMP flags)
|
||||
|
||||
int ident; // version 7 id
|
||||
|
||||
} dprograms_t;
|
||||
|
||||
typedef struct dlno_s
|
||||
{
|
||||
int header;
|
||||
int version;
|
||||
|
||||
uint numglobaldefs;
|
||||
uint numglobals;
|
||||
uint numfielddefs;
|
||||
uint numstatements;
|
||||
} dlno_t;
|
||||
|
||||
typedef struct mfunction_s
|
||||
{
|
||||
int first_statement; // negative numbers are builtins
|
||||
int parm_start;
|
||||
int locals; // total ints of parms + locals
|
||||
|
||||
// these are doubles so that they can count up to 54bits or so rather than 32bit
|
||||
double profile; // runtime
|
||||
double builtinsprofile; // cost of builtin functions called by this function
|
||||
double callcount; // times the functions has been called since the last profile call
|
||||
|
||||
int s_name;
|
||||
int s_file; // source file defined in
|
||||
int numparms;
|
||||
byte parm_size[MAX_PARMS];
|
||||
} mfunction_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char filename[128];
|
||||
int size;
|
||||
int compsize;
|
||||
int compmethod;
|
||||
int ofs;
|
||||
} includeddatafile_t;
|
||||
|
||||
typedef struct type_s
|
||||
{
|
||||
etype_t type;
|
||||
|
||||
struct type_s *parentclass; // type_entity...
|
||||
struct type_s *next;
|
||||
struct type_s *aux_type; // return type or field type
|
||||
struct type_s *param;
|
||||
|
||||
int num_parms; // -1 = variable args
|
||||
uint ofs; // inside a structure.
|
||||
uint size;
|
||||
char *name;
|
||||
} type_t;
|
||||
|
||||
typedef struct prvm_stack_s
|
||||
{
|
||||
int s;
|
||||
mfunction_t *f;
|
||||
} prvm_stack_t;
|
||||
|
||||
// virtual typedef
|
||||
typedef union prvm_eval_s
|
||||
{
|
||||
int edict;
|
||||
int _int;
|
||||
float _float;
|
||||
float vector[3];
|
||||
func_t function;
|
||||
string_t string;
|
||||
} prvm_eval_t;
|
||||
|
||||
typedef struct edict_state_s
|
||||
{
|
||||
bool free;
|
||||
float freetime;
|
||||
|
||||
} vm_edict_t;
|
||||
|
||||
struct edict_s
|
||||
{
|
||||
// engine-private fields (stored in dynamically resized array)
|
||||
union
|
||||
{
|
||||
void *vp; // generic edict
|
||||
vm_edict_t *ed; // vm edict state
|
||||
sv_edict_t *sv; // sv edict state
|
||||
cl_edict_t *cl; // cl edict state
|
||||
ui_edict_t *ui; // ui edict state
|
||||
} priv;
|
||||
|
||||
// QuakeC prog fields (stored in dynamically resized array)
|
||||
union
|
||||
{
|
||||
void *vp; // generic entvars
|
||||
sv_entvars_t *sv; // server entvars
|
||||
cl_entvars_t *cl; // client entvars
|
||||
ui_entvars_t *ui; // uimenu entvars
|
||||
} progs;
|
||||
|
||||
};
|
||||
|
||||
typedef struct prvm_prog_s
|
||||
{
|
||||
dprograms_t *progs;
|
||||
mfunction_t *functions;
|
||||
char *strings;
|
||||
int stringssize;
|
||||
ddef_t *fielddefs;
|
||||
ddef_t *globaldefs;
|
||||
dstatement_t *statements;
|
||||
includeddatafile_t *sources; // debug version include packed source files
|
||||
int *linenums; // debug versions only
|
||||
type_t *types;
|
||||
int edict_size; // in bytes
|
||||
int edictareasize; // in bytes (for bound checking)
|
||||
int pev_save; // used by PRVM_PUSH_GLOBALS\PRVM_POP_GLOBALS
|
||||
int other_save; // used by PRVM_PUSH_GLOBALS\PRVM_POP_GLOBALS
|
||||
int *statement_linenums;// NULL if not available
|
||||
double *statement_profile; // only incremented if prvm_statementprofiling is on
|
||||
|
||||
union
|
||||
{
|
||||
float *gp;
|
||||
sv_globalvars_t *sv;
|
||||
cl_globalvars_t *cl;
|
||||
ui_globalvars_t *ui;
|
||||
} globals;
|
||||
|
||||
int maxknownstrings;
|
||||
int numknownstrings;
|
||||
int firstfreeknownstring;
|
||||
const char **knownstrings;
|
||||
byte *knownstrings_freeable;
|
||||
const char ***stringshash;
|
||||
byte *progs_mempool;
|
||||
prvm_builtin_t *builtins;
|
||||
int numbuiltins;
|
||||
int argc;
|
||||
int trace;
|
||||
mfunction_t *xfunction;
|
||||
int xstatement;
|
||||
prvm_stack_t stack[PRVM_MAX_STACK_DEPTH + 1];
|
||||
int depth;
|
||||
int localstack[PRVM_LOCALSTACK_SIZE];
|
||||
int localstack_used;
|
||||
word filecrc;
|
||||
int intsize;
|
||||
vfile_t *file[PRVM_MAX_OPENFILES];
|
||||
search_t *search;
|
||||
int num_edicts;
|
||||
int max_edicts;
|
||||
int limit_edicts;
|
||||
int reserved_edicts;
|
||||
edict_t *edicts;
|
||||
void *edictsfields;
|
||||
void *edictprivate;
|
||||
int edictprivate_size;
|
||||
float *time;
|
||||
float _time;
|
||||
bool protect_world;
|
||||
bool loadintoworld;
|
||||
bool loaded;
|
||||
char *name;
|
||||
int flag;
|
||||
ddef_t *pev; // if pev != 0 then there is a global pev
|
||||
|
||||
// function pointers
|
||||
void (*begin_increase_edicts)(void);
|
||||
void (*end_increase_edicts)(void);
|
||||
void (*init_edict)(edict_t *edict);
|
||||
void (*free_edict)(edict_t *ed);
|
||||
void (*count_edicts)(void);
|
||||
bool (*load_edict)(edict_t *ent);
|
||||
void (*init_cmd)(void);
|
||||
void (*reset_cmd)(void);
|
||||
void (*error_cmd)(const char *format, ...);
|
||||
|
||||
} prvm_prog_t;
|
||||
|
||||
#endif//BASE_FILES_H
|
|
@ -1,66 +0,0 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ゥ
|
||||
// baseimages.h - builtin textures
|
||||
//=======================================================================
|
||||
#ifndef BASE_IMAGES_H
|
||||
#define BASE_IMAGES_H
|
||||
|
||||
static byte error_tga[] =
|
||||
{
|
||||
0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x20, 0x00, 0x20, 0x00, 0x18, 0x00, 0x9f, 0xff, 0xff, 0xff,
|
||||
0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff,
|
||||
0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d,
|
||||
0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff,
|
||||
0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
|
||||
0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80,
|
||||
0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00,
|
||||
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80,
|
||||
0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff,
|
||||
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00,
|
||||
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff,
|
||||
0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff,
|
||||
0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80,
|
||||
0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d,
|
||||
0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80,
|
||||
0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
|
||||
0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff,
|
||||
0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81,
|
||||
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff,
|
||||
0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff,
|
||||
0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d,
|
||||
0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff,
|
||||
0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
|
||||
0x80, 0x00, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff, 0x9f, 0xff,
|
||||
0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81,
|
||||
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff,
|
||||
0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff,
|
||||
0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d,
|
||||
0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff,
|
||||
0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
|
||||
0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80,
|
||||
0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00,
|
||||
0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80,
|
||||
0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff,
|
||||
0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff,
|
||||
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00,
|
||||
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff,
|
||||
0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff,
|
||||
0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80,
|
||||
0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d,
|
||||
0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80,
|
||||
0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80,
|
||||
0x80, 0x81, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff,
|
||||
0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81,
|
||||
0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff,
|
||||
0x00, 0xff, 0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff,
|
||||
0xff, 0x8d, 0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff,
|
||||
0xff, 0xff, 0x8d, 0x80, 0x80, 0x80, 0x81, 0xff, 0xff, 0xff, 0x8d,
|
||||
0x80, 0x80, 0x80, 0x00, 0xff, 0xff, 0xff, 0x9f, 0xff, 0xff, 0xff
|
||||
};
|
||||
|
||||
#endif//BASE_IMAGES_H
|
|
@ -6,192 +6,28 @@
|
|||
#define BASETYPES_H
|
||||
|
||||
#pragma warning(disable : 4244) // MIPS
|
||||
#pragma warning(disable : 4136) // X86
|
||||
#pragma warning(disable : 4051) // ALPHA
|
||||
#pragma warning(disable : 4018) // signed/unsigned mismatch
|
||||
#pragma warning(disable : 4305) // truncation from const double to float
|
||||
#pragma warning(disable : 4201) // nameless struct/union
|
||||
#pragma warning(disable : 4514) // unreferenced inline function removed
|
||||
#pragma warning(disable : 4100) // unreferenced formal parameter
|
||||
#pragma warning(disable : 4305) // truncation from const double to float (probably not needed)
|
||||
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#define DLLIMPORT __declspec(dllimport)
|
||||
|
||||
#define MIN_PATH 64
|
||||
#define MAX_QPATH 64 // get rid of this
|
||||
#define MAX_OSPATH 128
|
||||
#define MAX_NUM_ARGVS 128
|
||||
#define MAX_STRING 256
|
||||
#define MAX_SYSPATH 1024
|
||||
#define MAX_INPUTLINE 16384 // console buffer
|
||||
#define MAX_INFO_KEY 64
|
||||
#define MAX_INFO_VALUE 64
|
||||
#define MAX_INFO_STRING 512
|
||||
#define MAX_STRING_TOKENS 80
|
||||
#define MAX_TOKEN_CHARS 128
|
||||
#define MAX_STRING_CHARS 1024
|
||||
#define MAX_MSGLEN 32768 // max length of network message
|
||||
|
||||
#define COLOR_BLACK '0'
|
||||
#define COLOR_RED '1'
|
||||
#define COLOR_GREEN '2'
|
||||
#define COLOR_YELLOW '3'
|
||||
#define COLOR_BLUE '4'
|
||||
#define COLOR_CYAN '5'
|
||||
#define COLOR_MAGENTA '6'
|
||||
#define COLOR_WHITE '7'
|
||||
#define STRING_COLOR_TAG '^'
|
||||
#define ColorIndex(c) (((c) - '0') & 7)
|
||||
#define IsColorString(p) ( p && *(p) == STRING_COLOR_TAG && *((p)+1) && *((p)+1) != STRING_COLOR_TAG )
|
||||
#define bound(min, num, max) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min))
|
||||
|
||||
// command buffer modes
|
||||
#define EXEC_NOW 0
|
||||
#define EXEC_INSERT 1
|
||||
#define EXEC_APPEND 2
|
||||
|
||||
// timestamp modes
|
||||
#define TIME_FULL 0
|
||||
#define TIME_DATE_ONLY 1
|
||||
#define TIME_TIME_ONLY 2
|
||||
#define TIME_NO_SECONDS 3
|
||||
|
||||
// cvar flags
|
||||
#define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc
|
||||
#define CVAR_USERINFO 2 // added to userinfo when changed
|
||||
#define CVAR_SERVERINFO 4 // added to serverinfo when changed
|
||||
#define CVAR_SYSTEMINFO 8 // don't changed from console, saved into config.dll
|
||||
#define CVAR_INIT 16 // don't allow change from console at all, but can be set from the command line
|
||||
#define CVAR_LATCH 32 // save changes until server restart
|
||||
#define CVAR_READ_ONLY 64 // display only, cannot be set by user at all
|
||||
#define CVAR_USER_CREATED 128 // created by a set command (prvm used)
|
||||
#define CVAR_TEMP 256 // can be set even when cheats are disabled, but is not archived
|
||||
#define CVAR_CHEAT 512 // can not be changed if cheats are disabled
|
||||
#define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued
|
||||
#define CVAR_MAXFLAGSVAL 2047 // maximum number of flags
|
||||
|
||||
// euler angle order
|
||||
#define PITCH 0
|
||||
#define YAW 1
|
||||
#define ROLL 2
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#ifndef O_NONBLOCK
|
||||
#define O_NONBLOCK 0
|
||||
#endif
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef enum{ false, true } bool;
|
||||
#endif
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned long dword;
|
||||
typedef unsigned int uint;
|
||||
typedef signed __int64 int64;
|
||||
typedef struct cvar_s cvar_t;
|
||||
typedef struct file_s file_t;
|
||||
typedef struct vfile_s vfile_t;
|
||||
typedef struct image_s image_t;
|
||||
typedef struct model_s model_t;
|
||||
typedef int func_t;
|
||||
typedef struct edict_s edict_t;
|
||||
typedef int sound_t;
|
||||
typedef int string_t;
|
||||
typedef void (*xcommand_t) (void);
|
||||
typedef struct gclient_s gclient_t;
|
||||
typedef struct sv_edict_s sv_edict_t;
|
||||
typedef struct cl_edict_s cl_edict_t;
|
||||
typedef struct ui_edict_s ui_edict_t;
|
||||
typedef struct sv_entvars_s sv_entvars_t;
|
||||
typedef struct cl_entvars_s cl_entvars_t;
|
||||
typedef struct ui_entvars_s ui_entvars_t;
|
||||
typedef int progsnum_t;
|
||||
typedef struct progfuncs_s progfuncs_t;
|
||||
typedef struct physbody_s physbody_t;
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec2_t[2];
|
||||
typedef vec_t vec3_t[3];
|
||||
typedef vec_t vec4_t[4];
|
||||
typedef long fs_offset_t;
|
||||
typedef vec_t matrix3x3[3][3];
|
||||
typedef vec_t matrix3x4[3][4];
|
||||
typedef vec_t matrix4x3[4][3];
|
||||
typedef vec_t matrix4x4[4][4];
|
||||
typedef struct sv_globalvars_s sv_globalvars_t;
|
||||
typedef struct cl_globalvars_s cl_globalvars_t;
|
||||
typedef struct ui_globalvars_s ui_globalvars_t;
|
||||
typedef char string[MAX_STRING];
|
||||
typedef struct { size_t api_size; } generic_api_t;
|
||||
typedef struct { int fileofs; int filelen; } lump_t; // many formats use lumps to store blocks
|
||||
typedef struct { int type; char *name; } activity_map_t; // studio activity map conversion
|
||||
typedef struct { uint b:5; uint g:6; uint r:5; } color16;
|
||||
typedef struct { byte r:8; byte g:8; byte b:8; } color24;
|
||||
typedef struct { byte r; byte g; byte b; byte a; } color32;
|
||||
typedef struct { const char *name; void **func; } dllfunc_t; // Sys_LoadLibrary stuff
|
||||
typedef struct { int ofs; int type; const char *name; } fields_t; // prvm custom fields
|
||||
typedef void (*cmread_t) (void* handle, void* buffer, size_t size);
|
||||
typedef enum { mod_bad, mod_brush, mod_studio, mod_sprite } modtype_t;
|
||||
typedef void (*cmsave_t) (void* handle, const void* buffer, size_t size);
|
||||
typedef void (*cmdraw_t)( int color, int numpoints, const float *points );
|
||||
typedef struct { int numfilenames; char **filenames; char *filenamesbuffer; } search_t;
|
||||
typedef void (*cvarcmd_t)(const char *s, const char *m, const char *d, void *ptr );
|
||||
|
||||
enum host_state
|
||||
{ // paltform states
|
||||
HOST_OFFLINE = 0, // host_init( funcname *arg ) same much as:
|
||||
HOST_NORMAL, // "normal"
|
||||
HOST_DEDICATED, // "dedicated"
|
||||
HOST_VIEWER, // "viewer"
|
||||
HOST_CREDITS, // "splash" (easter egg)
|
||||
HOST_INSTALL, // "install"
|
||||
COMP_BSPLIB, // "bsplib"
|
||||
COMP_QCCLIB, // "qcclib"
|
||||
COMP_ROQLIB, // "roqlib"
|
||||
COMP_SPRITE, // "sprite"
|
||||
COMP_STUDIO, // "studio"
|
||||
COMP_WADLIB, // "wadlib"
|
||||
RIPP_MIPDEC, // "mipdec"
|
||||
RIPP_SPRDEC, // "sprdec"
|
||||
RIPP_MDLDEC, // "mdldec"
|
||||
RIPP_LMPDEC, // "lmpdec"
|
||||
RIPP_SNDDEC, // "snddec"
|
||||
RIPP_BSPDEC, // "bspdec"
|
||||
RIPP_QCCDEC, // "qccdec"
|
||||
HOST_NULL, // terminator
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SE_NONE = 0, // ev.time is still valid
|
||||
SE_KEY, // ev.value is a key code, ev.value2 is the down flag
|
||||
SE_CHAR, // ev.value is an ascii char
|
||||
SE_MOUSE, // ev.value and ev.value2 are reletive signed x / y moves
|
||||
SE_CONSOLE, // ev.data is a char*
|
||||
SE_PACKET // ev.data is a netadr_t followed by data bytes to ev.length
|
||||
} ev_type_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
dword time;
|
||||
ev_type_t type;
|
||||
int value[2];
|
||||
void *data;
|
||||
size_t length;
|
||||
} sys_event_t;
|
||||
|
||||
enum dev_level
|
||||
{
|
||||
D_INFO = 1, // "-dev 1", shows various system messages
|
||||
D_WARN, // "-dev 2", shows not critical system warnings
|
||||
D_ERROR, // "-dev 3", shows critical warnings
|
||||
D_LOAD, // "-dev 4", show messages about loading resources
|
||||
D_NOTE, // "-dev 5", show system notifications for engine develeopers
|
||||
D_MEMORY, // "-dev 6", show memory allocation
|
||||
};
|
||||
|
||||
#include "byteorder.h" // byte ordering swap functions
|
||||
#include "protocol.h" // network protocol
|
||||
|
||||
#endif//BASETYPES_H
|
6379
public/builtin.h
6379
public/builtin.h
File diff suppressed because it is too large
Load Diff
|
@ -5,8 +5,6 @@
|
|||
#ifndef BYTEORDER_H
|
||||
#define BYTEORDER_H
|
||||
|
||||
#include "basetypes.h"
|
||||
|
||||
// byte order swap functions
|
||||
_inline word WordSwap( word swap )
|
||||
{
|
||||
|
|
525
public/dllapi.h
525
public/dllapi.h
|
@ -1,525 +0,0 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// dllapi.h - shared ifaces between engine parts
|
||||
//=======================================================================
|
||||
#ifndef REF_SHARED_H
|
||||
#define REF_SHARED_H
|
||||
|
||||
#include "stdref.h"
|
||||
#include "protocol.h"
|
||||
|
||||
#define MAX_LIGHTSTYLES 256
|
||||
|
||||
#define EF_ROTATE (1<<0) // rotate (bonus items)
|
||||
|
||||
// shared client/renderer flags
|
||||
#define RF_MINLIGHT 1 // allways have some light (viewmodel)
|
||||
#define RF_PLAYERMODEL 2 // don't draw through eyes, only mirrors
|
||||
#define RF_VIEWMODEL 4 // it's a viewmodel
|
||||
#define RF_FULLBRIGHT 8 // allways draw full intensity
|
||||
#define RF_DEPTHHACK 16 // for view weapon Z crunching
|
||||
#define RF_TRANSLUCENT 32
|
||||
#define RF_IR_VISIBLE 64 // skin is an index in image_precache
|
||||
|
||||
// render private flags
|
||||
#define RDF_NOWORLDMODEL 1 // used for player configuration screen
|
||||
#define RDF_IRGOGGLES 2
|
||||
#define RDF_PAIN 4
|
||||
|
||||
// encoded bmodel mask
|
||||
#define SOLID_BMODEL 0xffffff
|
||||
|
||||
// content masks
|
||||
#define MASK_ALL (-1)
|
||||
#define MASK_SOLID (CONTENTS_SOLID|CONTENTS_WINDOW)
|
||||
#define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER)
|
||||
#define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW)
|
||||
#define MASK_MONSTERSOLID (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER)
|
||||
#define MASK_WATER (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME)
|
||||
#define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA)
|
||||
#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEADMONSTER)
|
||||
#define MASK_CURRENT (CONTENTS_CURRENT_0|CONTENTS_CURRENT_90|CONTENTS_CURRENT_180|CONTENTS_CURRENT_270|CONTENTS_CURRENT_UP|CONTENTS_CURRENT_DOWN)
|
||||
|
||||
// pmove_state_t is the information necessary for client side movement
|
||||
#define PM_NORMAL 0 // can accelerate and turn
|
||||
#define PM_SPECTATOR 1
|
||||
#define PM_DEAD 2 // no acceleration or turning
|
||||
#define PM_GIB 3 // different bounding box
|
||||
#define PM_FREEZE 4
|
||||
#define PM_INTERMISSION 5
|
||||
#define PM_NOCLIP 6
|
||||
|
||||
// pmove->pm_flags
|
||||
#define PMF_DUCKED 1
|
||||
#define PMF_JUMP_HELD 2
|
||||
#define PMF_ON_GROUND 4
|
||||
#define PMF_TIME_WATERJUMP 8 // pm_time is waterjump
|
||||
#define PMF_TIME_LAND 16 // pm_time is time before rejump
|
||||
#define PMF_TIME_TELEPORT 32 // pm_time is non-moving time
|
||||
#define PMF_NO_PREDICTION 64 // temporarily disables prediction (used for grappling hook)
|
||||
#define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_TELEPORT)
|
||||
|
||||
// button bits
|
||||
#define BUTTON_ATTACK 1
|
||||
#define BUTTON_ATTACK2 2
|
||||
#define BUTTON_USE 4
|
||||
#define BUTTON_WALKING 8
|
||||
#define BUTTON_ANY 128 // any key whatsoever
|
||||
|
||||
#define PM_MAXTOUCH 32
|
||||
|
||||
// sound channels
|
||||
#define CHAN_AUTO 0
|
||||
#define CHAN_WEAPON 1
|
||||
#define CHAN_VOICE 2
|
||||
#define CHAN_ITEM 3
|
||||
#define CHAN_BODY 4
|
||||
#define CHAN_ANNOUNCER 5 // announcer
|
||||
// flags
|
||||
#define CHAN_NO_PHS_ADD 8 // Send to all clients, not just ones in PHS (ATTN 0 will also do this)
|
||||
#define CHAN_RELIABLE 16 // Send by reliable message, not datagram
|
||||
|
||||
// Sound attenuation values
|
||||
#define ATTN_NONE 0 // Full volume the entire level
|
||||
#define ATTN_NORM 1
|
||||
#define ATTN_IDLE 2
|
||||
#define ATTN_STATIC 3 // Diminish very rapidly with distance
|
||||
|
||||
// player_state->stats[] indexes
|
||||
enum player_stats
|
||||
{
|
||||
STAT_HEALTH_ICON = 0,
|
||||
STAT_HEALTH,
|
||||
STAT_AMMO_ICON,
|
||||
STAT_AMMO,
|
||||
STAT_ARMOR_ICON,
|
||||
STAT_ARMOR,
|
||||
STAT_SELECTED_ICON,
|
||||
STAT_PICKUP_ICON,
|
||||
STAT_PICKUP_STRING,
|
||||
STAT_TIMER_ICON,
|
||||
STAT_TIMER,
|
||||
STAT_HELPICON,
|
||||
STAT_SELECTED_ITEM,
|
||||
STAT_LAYOUTS,
|
||||
STAT_FRAGS,
|
||||
STAT_FLASHES, // cleared each frame, 1 = health, 2 = armor
|
||||
STAT_CHASE,
|
||||
STAT_SPECTATOR,
|
||||
STAT_SPEED = 22,
|
||||
STAT_ZOOM,
|
||||
MAX_STATS = 32,
|
||||
};
|
||||
|
||||
typedef struct dlight_s
|
||||
{
|
||||
vec3_t origin;
|
||||
vec3_t color;
|
||||
float intensity;
|
||||
|
||||
} dlight_t;
|
||||
|
||||
typedef struct particle_s
|
||||
{
|
||||
vec3_t origin;
|
||||
int color;
|
||||
float alpha;
|
||||
|
||||
} particle_t;
|
||||
|
||||
typedef struct lightstyle_s
|
||||
{
|
||||
float rgb[3]; // 0.0 - 2.0
|
||||
float white; // highest of rgb
|
||||
|
||||
} lightstyle_t;
|
||||
|
||||
typedef struct latchedvars_s
|
||||
{
|
||||
float animtime;
|
||||
float sequencetime;
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
|
||||
int sequence;
|
||||
float frame;
|
||||
|
||||
byte blending[MAXSTUDIOBLENDS];
|
||||
byte seqblending[MAXSTUDIOBLENDS];
|
||||
byte controller[MAXSTUDIOCONTROLLERS];
|
||||
|
||||
} latchedvars_t;
|
||||
|
||||
// client entity
|
||||
typedef struct entity_s
|
||||
{
|
||||
model_t *model; // opaque type outside refresh
|
||||
model_t *weaponmodel; // opaque type outside refresh
|
||||
|
||||
latchedvars_t prev; // previous frame values for lerping
|
||||
|
||||
vec3_t angles;
|
||||
vec3_t origin; // also used as RF_BEAM's "from"
|
||||
float oldorigin[3]; // also used as RF_BEAM's "to"
|
||||
|
||||
float animtime;
|
||||
float frame; // also used as RF_BEAM's diameter
|
||||
float framerate;
|
||||
|
||||
int body;
|
||||
int skin;
|
||||
|
||||
byte blending[MAXSTUDIOBLENDS];
|
||||
byte controller[MAXSTUDIOCONTROLLERS];
|
||||
byte mouth; //TODO: move to struct
|
||||
|
||||
int movetype; //entity moving type
|
||||
int sequence;
|
||||
float scale;
|
||||
|
||||
vec3_t attachment[MAXSTUDIOATTACHMENTS];
|
||||
|
||||
// misc
|
||||
float backlerp; // 0.0 = current, 1.0 = old
|
||||
int skinnum; // also used as RF_BEAM's palette index
|
||||
|
||||
int lightstyle; // for flashing entities
|
||||
float alpha; // ignore if RF_TRANSLUCENT isn't set
|
||||
int flags;
|
||||
|
||||
} entity_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x, y, width, height;// in virtual screen coordinates
|
||||
float fov_x, fov_y;
|
||||
float vieworg[3];
|
||||
float viewangles[3];
|
||||
float blend[4]; // rgba 0-1 full screen blend
|
||||
float time; // time is used to auto animate
|
||||
int rdflags; // RDF_UNDERWATER, etc
|
||||
|
||||
byte *areabits; // if not NULL, only areas with set bits will be drawn
|
||||
|
||||
lightstyle_t *lightstyles; // [MAX_LIGHTSTYLES]
|
||||
|
||||
int num_entities;
|
||||
entity_t *entities; // [MAX_EDICTS]
|
||||
|
||||
int num_dlights;
|
||||
dlight_t *dlights;
|
||||
|
||||
int num_particles;
|
||||
particle_t *particles;
|
||||
|
||||
} refdef_t;
|
||||
|
||||
typedef struct pmove_s
|
||||
{
|
||||
player_state_t ps; // state (in / out)
|
||||
|
||||
// command (in)
|
||||
usercmd_t cmd;
|
||||
|
||||
physbody_t *body; // pointer to physobject
|
||||
|
||||
// results (out)
|
||||
int numtouch;
|
||||
edict_t *touchents[PM_MAXTOUCH]; // max touch
|
||||
|
||||
vec3_t mins, maxs; // bounding box size
|
||||
int watertype;
|
||||
int waterlevel;
|
||||
float xyspeed; // avoid to compute it twice
|
||||
|
||||
// callbacks to test the world
|
||||
trace_t (*trace)( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end );
|
||||
int (*pointcontents)( vec3_t point );
|
||||
} pmove_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
LAUNCH.DLL INTERFACE
|
||||
==============================================================================
|
||||
*/
|
||||
typedef struct launch_exp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(launch_api_t)
|
||||
|
||||
void ( *Init ) ( uint funcname, int argc, char **argv ); // init host
|
||||
void ( *Main ) ( void ); // host frame
|
||||
void ( *Free ) ( void ); // close host
|
||||
void (*CPrint) ( const char *msg ); // host print
|
||||
void (*MSG_Init)( sizebuf_t *buf, byte *data, size_t len ); // MSG init network buffer
|
||||
} launch_exp_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
IMGLIB.DLL INTERFACE
|
||||
==============================================================================
|
||||
*/
|
||||
typedef struct imglib_exp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(imglib_api_t)
|
||||
|
||||
void ( *Init ) ( uint funcname ); // init host
|
||||
void ( *Free ) ( void ); // close host
|
||||
|
||||
// global operations
|
||||
rgbdata_t *(*LoadImage)(const char *path, char *data, int size ); // extract image into rgba buffer
|
||||
void (*SaveImage)(const char *filename, rgbdata_t *buffer ); // save image into specified format
|
||||
|
||||
bool (*DecompressDXTC)( rgbdata_t **image );
|
||||
bool (*DecompressARGB)( rgbdata_t **image );
|
||||
|
||||
bool (*ResampleImage)( const char *name, rgbdata_t **pix, int w, int h, bool free_baseimage ); // resample image
|
||||
void (*FreeImage)( rgbdata_t *pack ); // free image buffer
|
||||
|
||||
} imglib_exp_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
RENDER.DLL INTERFACE
|
||||
==============================================================================
|
||||
*/
|
||||
typedef struct render_exp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(render_exp_t)
|
||||
|
||||
// initialize
|
||||
bool (*Init)( void *hInst ); // init all render systems
|
||||
void (*Shutdown)( void ); // shutdown all render systems
|
||||
|
||||
void (*BeginRegistration) (char *map);
|
||||
model_t *(*RegisterModel) (char *name);
|
||||
image_t *(*RegisterSkin) (char *name);
|
||||
image_t *(*RegisterPic) (char *name);
|
||||
void (*SetSky) (char *name, float rotate, vec3_t axis);
|
||||
void (*EndRegistration) (void);
|
||||
|
||||
void (*BeginFrame)( void );
|
||||
void (*RenderFrame) (refdef_t *fd);
|
||||
void (*EndFrame)( void );
|
||||
|
||||
void (*SetColor)( const float *rgba );
|
||||
bool (*ScrShot)( const char *filename, bool levelshot ); // write screenshot with same name
|
||||
void (*DrawFill)(float x, float y, float w, float h );
|
||||
void (*DrawStretchRaw)( int x, int y, int w, int h, int cols, int rows, byte *data, bool redraw );
|
||||
void (*DrawStretchPic)( float x, float y, float w, float h, float s1, float t1, float s2, float t2, const char *name );
|
||||
|
||||
void (*DrawGetPicSize)( int *w, int *h, const char *name );
|
||||
|
||||
} render_exp_t;
|
||||
|
||||
typedef struct render_imp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(render_imp_t)
|
||||
|
||||
// client fundamental callbacks
|
||||
void (*StudioEvent)( mstudioevent_t *event, entity_t *ent );
|
||||
void (*ShowCollision)( cmdraw_t callback ); // debug
|
||||
long (*WndProc)( void *hWnd, uint uMsg, uint wParam, long lParam );
|
||||
} render_imp_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
PHYSIC.DLL INTERFACE
|
||||
==============================================================================
|
||||
*/
|
||||
typedef struct physic_exp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(physic_exp_t)
|
||||
|
||||
// initialize
|
||||
bool (*Init)( void ); // init all physic systems
|
||||
void (*Shutdown)( void ); // shutdown all render systems
|
||||
|
||||
void (*LoadBSP)( const void *buf ); // load bspdata ( bsplib use this )
|
||||
void (*FreeBSP)( void ); // free bspdata
|
||||
void (*WriteCollisionLump)( file_t *f, cmsave_t callback ); // write collision data into LUMP_COLLISION
|
||||
|
||||
void (*DrawCollision)( cmdraw_t callback ); // debug draw world
|
||||
void (*Frame)( float time ); // physics frame
|
||||
|
||||
cmodel_t *(*BeginRegistration)( const char *name, bool clientload, uint *checksum );
|
||||
cmodel_t *(*RegisterModel)( const char *name );
|
||||
void (*EndRegistration)( void );
|
||||
|
||||
void (*SetAreaPortals)( byte *portals, size_t size );
|
||||
void (*GetAreaPortals)( byte **portals, size_t *size );
|
||||
void (*SetAreaPortalState)( int portalnum, bool open );
|
||||
|
||||
int (*NumClusters)( void );
|
||||
int (*NumTextures)( void );
|
||||
int (*NumBmodels )( void );
|
||||
const char *(*GetEntityString)( void );
|
||||
const char *(*GetTextureName)( int index );
|
||||
int (*PointContents)( const vec3_t p, cmodel_t *model );
|
||||
int (*TransformedPointContents)( const vec3_t p, cmodel_t *model, const vec3_t origin, const vec3_t angles );
|
||||
trace_t (*BoxTrace)( const vec3_t start, const vec3_t end, vec3_t mins, vec3_t maxs, cmodel_t *model, int brushmask, bool capsule );
|
||||
trace_t (*TransformedBoxTrace)( const vec3_t start, const vec3_t end, vec3_t mins, vec3_t maxs, cmodel_t *model, int brushmask, vec3_t origin, vec3_t angles, bool capsule );
|
||||
byte *(*ClusterPVS)( int cluster );
|
||||
byte *(*ClusterPHS)( int cluster );
|
||||
int (*PointLeafnum)( vec3_t p );
|
||||
int (*BoxLeafnums)( vec3_t mins, vec3_t maxs, int *list, int listsize, int *lastleaf );
|
||||
int (*LeafCluster)( int leafnum );
|
||||
int (*LeafArea)( int leafnum );
|
||||
bool (*AreasConnected)( int area1, int area2 );
|
||||
int (*WriteAreaBits)( byte *buffer, int area );
|
||||
|
||||
// player movement code
|
||||
void (*PlayerMove)( pmove_t *pmove, bool clientmove );
|
||||
|
||||
void (*ServerMove)( pmove_t *pmove );
|
||||
void (*ClientMove)( pmove_t *pmove );
|
||||
|
||||
// simple objects
|
||||
physbody_t *(*CreateBody)( sv_edict_t *ed, cmodel_t *mod, matrix4x3 transform, int solid );
|
||||
physbody_t *(*CreatePlayer)( sv_edict_t *ed, cmodel_t *mod, matrix4x3 transform );
|
||||
|
||||
void (*SetOrigin)( physbody_t *body, vec3_t origin );
|
||||
void (*SetParameters)( physbody_t *body, cmodel_t *mod, int material, float mass );
|
||||
bool (*GetForce)(physbody_t *body, vec3_t vel, vec3_t avel, vec3_t force, vec3_t torque );
|
||||
void (*SetForce)(physbody_t *body, vec3_t vel, vec3_t avel, vec3_t force, vec3_t torque );
|
||||
bool (*GetMassCentre)( physbody_t *body, matrix3x3 mass );
|
||||
void (*SetMassCentre)( physbody_t *body, matrix3x3 mass );
|
||||
void (*RemoveBody)( physbody_t *body );
|
||||
} physic_exp_t;
|
||||
|
||||
typedef struct physic_imp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(physic_imp_t)
|
||||
|
||||
void (*ClientMove)( sv_edict_t *ed );
|
||||
void (*Transform)( sv_edict_t *ed, matrix4x3 transform );
|
||||
void (*PlaySound)( sv_edict_t *ed, float volume, const char *sample );
|
||||
float *(*GetModelVerts)( sv_edict_t *ent, int *numvertices );
|
||||
} physic_imp_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
VPROGS.DLL INTERFACE
|
||||
==============================================================================
|
||||
*/
|
||||
typedef struct vprogs_exp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(vprogs_api_t)
|
||||
|
||||
void ( *Init ) ( uint funcname, int argc, char **argv ); // init host
|
||||
void ( *Free ) ( void ); // close host
|
||||
|
||||
// compiler functions
|
||||
void ( *PrepareDAT )( const char *dir, const char *name );
|
||||
void ( *CompileDAT )( void );
|
||||
bool ( *DecompileDAT )( const char *name );
|
||||
void ( *Update )( dword time ); // refreshing compile, exec some programs e.t.c
|
||||
|
||||
// edict operations
|
||||
void (*WriteGlobals)( vfile_t *f );
|
||||
void (*ParseGlobals)( const char *data );
|
||||
void (*PrintEdict)( edict_t *ed );
|
||||
void (*WriteEdict)( vfile_t *f, edict_t *ed );
|
||||
const char *(*ParseEdict)( const char *data, edict_t *ed );
|
||||
edict_t *(*AllocEdict)( void );
|
||||
void (*FreeEdict)( edict_t *ed );
|
||||
void (*IncreaseEdicts)( void );
|
||||
|
||||
// load ents description
|
||||
void (*LoadFromFile)( const char *data );
|
||||
|
||||
// string manipulations
|
||||
const char *(*GetString)( int num );
|
||||
int (*SetEngineString)( const char *s );
|
||||
int (*SetTempString)( const char *s );
|
||||
int (*AllocString)( size_t bufferlength, char **pointer );
|
||||
void (*FreeString)( int num );
|
||||
|
||||
void (*InitProg)( int prognr );
|
||||
void (*SetProg)( int prognr );
|
||||
bool (*ProgLoaded)( int prognr );
|
||||
void (*LoadProgs)( const char *filename, int numrequiredfunc, char **required_func, int numrequiredfields, fields_t *required_field );
|
||||
void (*ResetProg)( void );
|
||||
|
||||
// abstract layer for searching globals and locals
|
||||
func_t (*FindFunctionOffset)( const char *function );
|
||||
int (*FindGlobalOffset)( const char *global );
|
||||
int (*FindFieldOffset)( const char *field );
|
||||
mfunction_t *(*FindFunction)( const char *name );
|
||||
ddef_t *(*FindGlobal)( const char *name );
|
||||
ddef_t *(*FindField)( const char *name );
|
||||
|
||||
void (*StackTrace)( void );
|
||||
void (*Warning)( const char *fmt, ... );
|
||||
void (*Error)( const char *fmt, ... );
|
||||
|
||||
void (*ExecuteProgram)( func_t fnum, const char *name, const char *file, const int line );
|
||||
void (*Crash)( void ); // crash virtual machine
|
||||
|
||||
prvm_prog_t *prog; // virtual machine current state
|
||||
|
||||
} vprogs_exp_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
VSOUND.DLL INTERFACE
|
||||
==============================================================================
|
||||
*/
|
||||
typedef struct vsound_exp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(vprogs_api_t)
|
||||
|
||||
void (*Init)( void *hInst ); // init host
|
||||
void (*Shutdown)( void ); // close host
|
||||
|
||||
// sound manager
|
||||
void (*BeginRegistration)( void );
|
||||
sound_t (*RegisterSound)( const char *name );
|
||||
void (*EndRegistration)( void );
|
||||
|
||||
void (*StartSound)( const vec3_t pos, int entnum, int channel, sound_t sfx, float vol, float attn, bool use_loop );
|
||||
void (*StreamRawSamples)( int samples, int rate, int width, int channels, const byte *data );
|
||||
bool (*AddLoopingSound)( int entnum, sound_t handle, float volume, float attn );
|
||||
bool (*StartLocalSound)( const char *name );
|
||||
void (*StartBackgroundTrack)( const char *introTrack, const char *loopTrack );
|
||||
void (*StopBackgroundTrack)( void );
|
||||
|
||||
void (*StartStreaming)( void );
|
||||
void (*StopStreaming)( void );
|
||||
|
||||
void (*Frame)( int entnum, const vec3_t pos, const vec3_t vel, const vec3_t at, const vec3_t up );
|
||||
void (*StopAllSounds)( void );
|
||||
void (*FreeSounds)( void );
|
||||
|
||||
void (*Activate)( bool active );
|
||||
|
||||
} vsound_exp_t;
|
||||
|
||||
typedef struct vsound_imp_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(vsound_imp_t)
|
||||
|
||||
void (*GetSoundSpatialization)( int entnum, vec3_t origin, vec3_t velocity );
|
||||
int (*PointContents)( vec3_t point );
|
||||
void (*AddLoopingSounds)( void );
|
||||
|
||||
} vsound_imp_t;
|
||||
|
||||
// this is the only function actually exported at the linker level
|
||||
typedef void *(*launch_t)( stdlib_api_t*, void* );
|
||||
|
||||
#endif//REF_SHARED_H
|
|
@ -6,8 +6,6 @@
|
|||
#define BASEMATH_H
|
||||
|
||||
#include <math.h>
|
||||
#include "basetypes.h"
|
||||
#include "stdref.h"
|
||||
|
||||
#define SIDE_FRONT 0
|
||||
#define SIDE_BACK 1
|
||||
|
|
|
@ -1,297 +0,0 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2008 ©
|
||||
// protocol.h - engine network protocol
|
||||
//=======================================================================
|
||||
#ifndef NET_PROTOCOL_H
|
||||
#define NET_PROTOCOL_H
|
||||
|
||||
#define USE_COORD_FRAC
|
||||
|
||||
#define NETENT_MAXFLAGS 4 // 4 bytes * ( int )
|
||||
|
||||
#define MAXEDICT_BITS 12 // 4096 entity per one map
|
||||
#define MAX_EDICTS (1<<MAXEDICT_BITS) // must change protocol to increase more
|
||||
#define INVALID_EDICT (MAX_EDICTS - 1)
|
||||
#define INVALID_DELTA -99 // packet no contains delta message
|
||||
#define MAX_DATAGRAM 2048 // datagram size
|
||||
#define MAX_MSGLEN 32768 // max length of network message
|
||||
|
||||
// network precision coords factor
|
||||
#ifdef USE_COORD_FRAC
|
||||
#define SV_COORD_FRAC (8.0f / 1.0f)
|
||||
#define CL_COORD_FRAC (1.0f / 8.0f)
|
||||
#else
|
||||
#define SV_COORD_FRAC 1.0f
|
||||
#define CL_COORD_FRAC 1.0f
|
||||
#endif
|
||||
|
||||
#define SV_ANGLE_FRAC (360.0f / 1.0f )
|
||||
#define CL_ANGLE_FRAC (1.0f / 360.0f )
|
||||
|
||||
typedef enum { NA_BAD, NA_LOOPBACK, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX } netadrtype_t;
|
||||
typedef enum { NS_CLIENT, NS_SERVER } netsrc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
netadrtype_t type;
|
||||
byte ip[4];
|
||||
byte ipx[10];
|
||||
word port;
|
||||
} netadr_t;
|
||||
|
||||
typedef struct sizebuf_s
|
||||
{
|
||||
bool overflowed; // set to true if the buffer size failed
|
||||
|
||||
byte *data;
|
||||
int maxsize;
|
||||
int cursize;
|
||||
int readcount;
|
||||
} sizebuf_t;
|
||||
|
||||
enum net_types_e
|
||||
{
|
||||
NET_BAD = 0,
|
||||
NET_CHAR,
|
||||
NET_BYTE,
|
||||
NET_SHORT,
|
||||
NET_WORD,
|
||||
NET_LONG,
|
||||
NET_FLOAT,
|
||||
NET_ANGLE,
|
||||
NET_SCALE,
|
||||
NET_COORD,
|
||||
NET_COLOR,
|
||||
NET_TYPES,
|
||||
};
|
||||
|
||||
typedef struct net_desc_s
|
||||
{
|
||||
int type; // pixelformat
|
||||
char name[8]; // used for debug
|
||||
int min_range;
|
||||
int max_range;
|
||||
} net_desc_t;
|
||||
|
||||
// communication state description
|
||||
typedef struct net_field_s
|
||||
{
|
||||
char *name;
|
||||
int offset;
|
||||
int bits;
|
||||
bool force; // will be send for newentity
|
||||
} net_field_t;
|
||||
|
||||
// entity_state_t communication
|
||||
typedef struct entity_state_s
|
||||
{
|
||||
uint number; // edict index
|
||||
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
vec3_t old_origin; // for lerping animation
|
||||
int modelindex;
|
||||
int soundindex;
|
||||
int weaponmodel;
|
||||
|
||||
int skin; // skin for studiomodels
|
||||
float frame; // % playback position in animation sequences (0..512)
|
||||
int body; // sub-model selection for studiomodels
|
||||
int sequence; // animation sequence (0 - 255)
|
||||
uint effects; // PGM - we're filling it, so it needs to be unsigned
|
||||
int renderfx;
|
||||
int solid; // for client side prediction, 8*(bits 0-4) is x/y radius
|
||||
// 8*(bits 5-9) is z down distance, 8(bits10-15) is z up
|
||||
// gi.linkentity sets this properly
|
||||
float alpha; // alpha value
|
||||
float animtime; // auto-animating time
|
||||
|
||||
} entity_state_t;
|
||||
|
||||
// viewmodel state
|
||||
typedef struct vmodel_state_s
|
||||
{
|
||||
int index; // client modelindex
|
||||
vec3_t angles; // can be some different with viewangles
|
||||
vec3_t offset; // center offset
|
||||
int sequence; // studio animation sequence
|
||||
float frame; // studio frame
|
||||
int body; // weapon body
|
||||
int skin; // weapon skin
|
||||
} vmodel_state_t;
|
||||
|
||||
// thirdperson model state
|
||||
typedef struct pmodel_state_s
|
||||
{
|
||||
int index; // client modelindex
|
||||
int sequence; // studio animation sequence
|
||||
float frame; // studio frame
|
||||
} pmodel_state_t;
|
||||
|
||||
// player_state_t communication
|
||||
typedef struct player_state_s
|
||||
{
|
||||
int bobcycle; // for view bobbing and footstep generation
|
||||
float bobtime;
|
||||
int pm_type; // player movetype
|
||||
int pm_flags; // ducked, jump_held, etc
|
||||
int pm_time; // each unit = 8 ms
|
||||
#ifdef USE_COORD_FRAC
|
||||
int origin[3];
|
||||
int velocity[3];
|
||||
#else
|
||||
vec3_t origin;
|
||||
vec3_t velocity;
|
||||
#endif
|
||||
vec3_t delta_angles; // add to command angles to get view direction
|
||||
int gravity; // gravity value
|
||||
int speed; // maxspeed
|
||||
edict_t *groundentity; // current ground entity
|
||||
int viewheight; // height over ground
|
||||
int effects; // copied to entity_state_t->effects
|
||||
vec3_t viewangles; // for fixed views
|
||||
vec3_t viewoffset; // add to pmovestate->origin
|
||||
vec3_t kick_angles; // add to view direction to get render angles
|
||||
vec3_t oldviewangles; // for lerping viewmodel position
|
||||
vec4_t blend; // rgba full screen effect
|
||||
int stats[32]; // integer limit
|
||||
float fov; // horizontal field of view
|
||||
|
||||
// player model and viewmodel
|
||||
vmodel_state_t vmodel;
|
||||
pmodel_state_t pmodel;
|
||||
|
||||
} player_state_t;
|
||||
|
||||
// usercmd_t communication
|
||||
typedef struct usercmd_s
|
||||
{
|
||||
int msec;
|
||||
int angles[3];
|
||||
int forwardmove;
|
||||
int sidemove;
|
||||
int upmove;
|
||||
int buttons;
|
||||
int impulse;
|
||||
int lightlevel;
|
||||
|
||||
} usercmd_t;
|
||||
|
||||
static const net_desc_t NWDesc[] =
|
||||
{
|
||||
{ NET_BAD, "none", 0, 0 }, // full range
|
||||
{ NET_CHAR, "Char", -128, 127 },
|
||||
{ NET_BYTE, "Byte", 0, 255 },
|
||||
{ NET_SHORT, "Short", -32767, 32767 },
|
||||
{ NET_WORD, "Word", 0, 65535 },
|
||||
{ NET_LONG, "Long", 0, 0 },
|
||||
{ NET_FLOAT, "Float", 0, 0 },
|
||||
{ NET_ANGLE, "Angle", -360, 360 },
|
||||
{ NET_SCALE, "Scale", 0, 0 },
|
||||
{ NET_COORD, "Coord", -262140, 262140 },
|
||||
{ NET_COLOR, "Color", 0, 255 },
|
||||
};
|
||||
|
||||
#define ES_FIELD(x) #x,(int)&((entity_state_t*)0)->x
|
||||
#define PS_FIELD(x) #x,(int)&((player_state_t*)0)->x
|
||||
#define CM_FIELD(x) #x,(int)&((usercmd_t*)0)->x
|
||||
|
||||
static net_field_t ent_fields[] =
|
||||
{
|
||||
{ ES_FIELD(origin[0]), NET_FLOAT, false },
|
||||
{ ES_FIELD(origin[1]), NET_FLOAT, false },
|
||||
{ ES_FIELD(origin[2]), NET_FLOAT, false },
|
||||
{ ES_FIELD(angles[0]), NET_FLOAT, false },
|
||||
{ ES_FIELD(angles[1]), NET_FLOAT, false },
|
||||
{ ES_FIELD(angles[2]), NET_FLOAT, false },
|
||||
{ ES_FIELD(old_origin[0]), NET_FLOAT, true },
|
||||
{ ES_FIELD(old_origin[1]), NET_FLOAT, true },
|
||||
{ ES_FIELD(old_origin[2]), NET_FLOAT, true },
|
||||
{ ES_FIELD(modelindex), NET_WORD, false }, // 4096 models
|
||||
{ ES_FIELD(soundindex), NET_WORD, false }, // 512 sounds ( OpenAL software limit is 255 )
|
||||
{ ES_FIELD(weaponmodel), NET_WORD, false }, // 4096 models
|
||||
{ ES_FIELD(skin), NET_BYTE, false }, // 255 skins
|
||||
{ ES_FIELD(frame), NET_FLOAT, false }, // interpolate value
|
||||
{ ES_FIELD(body), NET_BYTE, false }, // 255 bodies
|
||||
{ ES_FIELD(sequence), NET_WORD, false }, // 1024 sequences
|
||||
{ ES_FIELD(effects), NET_LONG, false }, // effect flags
|
||||
{ ES_FIELD(renderfx), NET_LONG, false }, // renderfx flags
|
||||
{ ES_FIELD(solid), NET_LONG, false }, // encoded mins/maxs
|
||||
{ ES_FIELD(alpha), NET_FLOAT, false }, // alpha value (FIXME: send a byte ? )
|
||||
{ ES_FIELD(animtime), NET_FLOAT, false }, // auto-animating time
|
||||
{ NULL }, // terminator
|
||||
};
|
||||
|
||||
static net_field_t ps_fields[] =
|
||||
{
|
||||
{ PS_FIELD(pm_type), NET_BYTE, false }, // 16 player movetypes allowed
|
||||
{ PS_FIELD(pm_flags), NET_WORD, true }, // 16 movetype flags allowed
|
||||
{ PS_FIELD(pm_time), NET_BYTE, true }, // each unit 8 msec
|
||||
#ifdef USE_COORD_FRAC
|
||||
{ PS_FIELD(origin[0]), NET_COORD, false },
|
||||
{ PS_FIELD(origin[1]), NET_COORD, false },
|
||||
{ PS_FIELD(origin[2]), NET_COORD, false },
|
||||
{ PS_FIELD(velocity[0]), NET_COORD, false },
|
||||
{ PS_FIELD(velocity[1]), NET_COORD, false },
|
||||
{ PS_FIELD(velocity[2]), NET_COORD, false },
|
||||
#else
|
||||
{ PS_FIELD(origin[0]), NET_FLOAT, false },
|
||||
{ PS_FIELD(origin[1]), NET_FLOAT, false },
|
||||
{ PS_FIELD(origin[2]), NET_FLOAT, false },
|
||||
{ PS_FIELD(velocity[0]), NET_FLOAT, false },
|
||||
{ PS_FIELD(velocity[1]), NET_FLOAT, false },
|
||||
{ PS_FIELD(velocity[2]), NET_FLOAT, false },
|
||||
#endif
|
||||
{ PS_FIELD(delta_angles[0]), NET_FLOAT, false },
|
||||
{ PS_FIELD(delta_angles[1]), NET_FLOAT, false },
|
||||
{ PS_FIELD(delta_angles[2]), NET_FLOAT, false },
|
||||
{ PS_FIELD(gravity), NET_SHORT, false }, // may be 12 bits ?
|
||||
{ PS_FIELD(effects), NET_LONG, false }, // copied to entity_state_t->effects
|
||||
{ PS_FIELD(viewangles[0]), NET_FLOAT, false }, // for fixed views
|
||||
{ PS_FIELD(viewangles[1]), NET_FLOAT, false },
|
||||
{ PS_FIELD(viewangles[2]), NET_FLOAT, false },
|
||||
{ PS_FIELD(viewoffset[0]), NET_SCALE, false }, // get rid of this
|
||||
{ PS_FIELD(viewoffset[1]), NET_SCALE, false },
|
||||
{ PS_FIELD(viewoffset[2]), NET_SCALE, false },
|
||||
{ PS_FIELD(kick_angles[0]), NET_SCALE, false },
|
||||
{ PS_FIELD(kick_angles[1]), NET_SCALE, false },
|
||||
{ PS_FIELD(kick_angles[2]), NET_SCALE, false },
|
||||
{ PS_FIELD(blend[0]), NET_COLOR, false }, // FIXME: calc on client, don't send over the net
|
||||
{ PS_FIELD(blend[1]), NET_COLOR, false },
|
||||
{ PS_FIELD(blend[2]), NET_COLOR, false },
|
||||
{ PS_FIELD(blend[3]), NET_COLOR, false },
|
||||
{ PS_FIELD(fov), NET_FLOAT, false }, // FIXME: send as byte * 4 ?
|
||||
{ PS_FIELD(vmodel.index), NET_WORD, false }, // 4096 models
|
||||
{ PS_FIELD(vmodel.angles[0]), NET_SCALE, false }, // can be some different with viewangles
|
||||
{ PS_FIELD(vmodel.angles[1]), NET_SCALE, false },
|
||||
{ PS_FIELD(vmodel.angles[2]), NET_SCALE, false },
|
||||
{ PS_FIELD(vmodel.offset[0]), NET_SCALE, false }, // center offset
|
||||
{ PS_FIELD(vmodel.offset[1]), NET_SCALE, false },
|
||||
{ PS_FIELD(vmodel.offset[2]), NET_SCALE, false },
|
||||
{ PS_FIELD(vmodel.sequence), NET_WORD, false }, // 1024 sequences
|
||||
{ PS_FIELD(vmodel.frame), NET_FLOAT, false }, // interpolate value
|
||||
{ PS_FIELD(vmodel.body), NET_BYTE, false }, // 255 bodies
|
||||
{ PS_FIELD(vmodel.skin), NET_BYTE, false }, // 255 skins
|
||||
{ PS_FIELD(pmodel.index), NET_WORD, false }, // 4096 models
|
||||
{ PS_FIELD(pmodel.sequence), NET_WORD, false }, // 1024 sequences
|
||||
{ PS_FIELD(vmodel.frame), NET_FLOAT, false }, // interpolate value
|
||||
{ NULL }, // terminator
|
||||
};
|
||||
|
||||
// probably usercmd_t never reached 32 field integer limit (in theory of course)
|
||||
static net_field_t cmd_fields[] =
|
||||
{
|
||||
{ CM_FIELD(msec), NET_BYTE, true },
|
||||
{ CM_FIELD(angles[0]), NET_WORD, false },
|
||||
{ CM_FIELD(angles[1]), NET_WORD, false },
|
||||
{ CM_FIELD(angles[2]), NET_WORD, false },
|
||||
{ CM_FIELD(forwardmove), NET_SHORT, false },
|
||||
{ CM_FIELD(sidemove), NET_SHORT, false },
|
||||
{ CM_FIELD(upmove), NET_SHORT, false },
|
||||
{ CM_FIELD(buttons), NET_BYTE, false },
|
||||
{ CM_FIELD(impulse), NET_BYTE, false },
|
||||
{ CM_FIELD(lightlevel), NET_BYTE, false },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
#endif//NET_PROTOCOL_H
|
|
@ -0,0 +1,884 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// ref_dfiles.h - xash supported formats
|
||||
//=======================================================================
|
||||
#ifndef REF_DFILES_H
|
||||
#define REF_DFILES_H
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
SPRITE MODELS
|
||||
|
||||
.spr32 extended version (Darkplaces non-paletted 32-bit sprites)
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#define IDSPRITEHEADER (('P'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDSP"
|
||||
#define SPRITE_VERSION 32 // DarkPlaces SPR32
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ST_SYNC = 0,
|
||||
ST_RAND
|
||||
} synctype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPR_SINGLE = 0,
|
||||
SPR_GROUP,
|
||||
SPR_ANGLED
|
||||
} frametype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPR_SOLID = 0,
|
||||
SPR_ADDITIVE,
|
||||
SPR_GLOW,
|
||||
SPR_ALPHA
|
||||
} drawtype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPR_FWD_PARALLEL_UPRIGHT = 0,
|
||||
SPR_FACING_UPRIGHT,
|
||||
SPR_FWD_PARALLEL,
|
||||
SPR_ORIENTED,
|
||||
SPR_FWD_PARALLEL_ORIENTED,
|
||||
SPR_LABEL, // DP extension
|
||||
SPR_LABEL_SCALE,
|
||||
} angletype_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SPR_SINGLE_FACE = 0, // oriented sprite will be draw with one face
|
||||
SPR_DOUBLE_FACE, // oriented sprite will be draw back face too
|
||||
SPR_XCROSS_FACE, // same like as flame in UT'99
|
||||
} facetype_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident; // LittleLong 'ISPR'
|
||||
int version; // current version 3
|
||||
angletype_t type; // camera align
|
||||
drawtype_t rendermode; // rendering mode (Xash3D ext)
|
||||
int bounds[2]; // minsmaxs
|
||||
int numframes; // including groups
|
||||
facetype_t facetype; // cullface (Xash3D ext)
|
||||
synctype_t synctype; // animation synctype
|
||||
} dsprite_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int origin[2];
|
||||
int width;
|
||||
int height;
|
||||
} dframe_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numframes;
|
||||
} dspritegroup_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float interval;
|
||||
} dspriteinterval_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
frametype_t type;
|
||||
} dframetype_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
BRUSH MODELS
|
||||
|
||||
.bsp contain level static geometry with including PVS, PHS, PHYS and lightning info
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
// header
|
||||
#define BSPMOD_VERSION 39
|
||||
#define IDBSPMODHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I') // little-endian "IBSP"
|
||||
|
||||
// 32 bit limits
|
||||
#define MAX_KEY 128
|
||||
#define MAX_VALUE 512
|
||||
#define MAX_MAP_AREAS 0x100 // don't increase this
|
||||
#define MAX_MAP_MODELS 0x2000 // mesh models and sprites too
|
||||
#define MAX_MAP_AREAPORTALS 0x400
|
||||
#define MAX_MAP_ENTITIES 0x2000
|
||||
#define MAX_MAP_TEXINFO 0x2000
|
||||
#define MAX_MAP_BRUSHES 0x8000
|
||||
#define MAX_MAP_PLANES 0x20000
|
||||
#define MAX_MAP_NODES 0x20000
|
||||
#define MAX_MAP_BRUSHSIDES 0x20000
|
||||
#define MAX_MAP_LEAFS 0x20000
|
||||
#define MAX_MAP_VERTS 0x80000
|
||||
#define MAX_MAP_FACES 0x20000
|
||||
#define MAX_MAP_LEAFFACES 0x20000
|
||||
#define MAX_MAP_LEAFBRUSHES 0x40000
|
||||
#define MAX_MAP_PORTALS 0x20000
|
||||
#define MAX_MAP_EDGES 0x80000
|
||||
#define MAX_MAP_SURFEDGES 0x80000
|
||||
#define MAX_MAP_ENTSTRING 0x80000
|
||||
#define MAX_MAP_LIGHTING 0x800000
|
||||
#define MAX_MAP_VISIBILITY 0x800000
|
||||
#define MAX_MAP_COLLISION 0x800000
|
||||
#define MAX_MAP_STRINGDATA 0x40000
|
||||
#define MAX_MAP_NUMSTRINGS 0x10000
|
||||
|
||||
// game limits
|
||||
#define MAX_MODELS MAX_MAP_MODELS>>1 // brushmodels and other models
|
||||
#define MAX_WORLD_COORD ( 128 * 1024 )
|
||||
#define MIN_WORLD_COORD (-128 * 1024 )
|
||||
#define WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD )
|
||||
|
||||
// lump offset
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_PLANES 1
|
||||
#define LUMP_LEAFS 2
|
||||
#define LUMP_LEAFFACES 3
|
||||
#define LUMP_LEAFBRUSHES 4
|
||||
#define LUMP_NODES 5
|
||||
#define LUMP_VERTEXES 6
|
||||
#define LUMP_EDGES 7
|
||||
#define LUMP_SURFEDGES 8
|
||||
#define LUMP_SURFDESC 9
|
||||
#define LUMP_FACES 10
|
||||
#define LUMP_MODELS 11
|
||||
#define LUMP_BRUSHES 12
|
||||
#define LUMP_BRUSHSIDES 13
|
||||
#define LUMP_VISIBILITY 14
|
||||
#define LUMP_LIGHTING 15
|
||||
#define LUMP_COLLISION 16 // newton collision tree (worldmodel coords already convert to meters)
|
||||
#define LUMP_BVHSTATIC 17 // bullet collision tree (currently not used)
|
||||
#define LUMP_SVPROGS 18 // private server.dat for current map
|
||||
#define LUMP_WAYPOINTS 19 // AI navigate tree (like .aas file for quake3)
|
||||
#define LUMP_STRINGDATA 20 // string array
|
||||
#define LUMP_STRINGTABLE 21 // string table id's
|
||||
|
||||
// get rid of this
|
||||
#define LUMP_AREAS 22
|
||||
#define LUMP_AREAPORTALS 23
|
||||
|
||||
#define LUMP_TOTALCOUNT 32 // max lumps
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
//other limits
|
||||
#define MAXLIGHTMAPS 4
|
||||
typedef struct
|
||||
{
|
||||
int fileofs;
|
||||
int filelen;
|
||||
} lump_t; // many formats use lumps to store blocks
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
lump_t lumps[LUMP_TOTALCOUNT];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float mins[3];
|
||||
float maxs[3];
|
||||
int headnode;
|
||||
int firstface; // submodels just draw faces
|
||||
int numfaces; // without walking the bsp tree
|
||||
int firstbrush; // physics stuff
|
||||
int numbrushes;
|
||||
} dmodel_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float point[3];
|
||||
} dvertex_t;
|
||||
|
||||
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];
|
||||
int firstface;
|
||||
int numfaces; // counting both sides
|
||||
} dnode_t;
|
||||
|
||||
typedef struct dsurfdesc_s
|
||||
{
|
||||
float vecs[2][4]; // [s/t][xyz offset] texture s\t
|
||||
int size[2]; // valid size for current s\t coords (used for replace texture)
|
||||
int texid; // string table texture id number
|
||||
int animid; // string table animchain id number
|
||||
int flags; // surface flags
|
||||
int value; // used by qrad, not engine
|
||||
} dsurfdesc_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int v[2]; // vertex numbers
|
||||
} dedge_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int firstedge;
|
||||
int numedges;
|
||||
int desc;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
|
||||
// get rid of this
|
||||
short side;
|
||||
} dface_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int contents; // or of all brushes (not needed?)
|
||||
int cluster;
|
||||
int area;
|
||||
int mins[3]; // for frustum culling
|
||||
int maxs[3];
|
||||
int firstleafface;
|
||||
int numleaffaces;
|
||||
int firstleafbrush;
|
||||
int numleafbrushes;
|
||||
} dleaf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum; // facing out of the leaf
|
||||
int surfdesc; // surface description (s/t coords, flags, etc)
|
||||
} dbrushside_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int firstside;
|
||||
int numsides;
|
||||
int contents;
|
||||
} dbrush_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numclusters;
|
||||
int bitofs[8][2]; // bitofs[numclusters][2]
|
||||
} dvis_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int portalnum;
|
||||
int otherarea;
|
||||
} dareaportal_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numareaportals;
|
||||
int firstareaportal;
|
||||
} darea_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
VIRTUAL MACHINE
|
||||
|
||||
a internal virtual machine like as QuakeC, but it has more extensions
|
||||
==============================================================================
|
||||
*/
|
||||
// header
|
||||
#define QPROGS_VERSION 6 // Quake1 progs version
|
||||
#define FPROGS_VERSION 7 // Fte progs version
|
||||
#define VPROGS_VERSION 8 // xash progs version
|
||||
#define LNNUMS_VERSION 1 // line numbers version
|
||||
|
||||
#define VPROGSHEADER16 (('6'<<24)+('1'<<16)+('D'<<8)+'I') // little-endian "ID16"
|
||||
#define VPROGSHEADER32 (('2'<<24)+('3'<<16)+('D'<<8)+'I') // little-endian "ID32"
|
||||
#define LINENUMSHEADER (('F'<<24)+('O'<<16)+('N'<<8)+'L') // little-endian "LNOF"
|
||||
|
||||
// global ofsets
|
||||
#define OFS_NULL 0
|
||||
#define OFS_RETURN 1
|
||||
#define OFS_PARM0 4
|
||||
#define OFS_PARM1 7
|
||||
#define OFS_PARM2 10
|
||||
#define OFS_PARM3 13
|
||||
#define OFS_PARM4 16
|
||||
#define OFS_PARM5 19
|
||||
#define OFS_PARM6 22
|
||||
#define OFS_PARM7 25
|
||||
#define RESERVED_OFS 28
|
||||
|
||||
// misc flags
|
||||
#define DEF_SHARED (1<<14)
|
||||
#define DEF_SAVEGLOBAL (1<<15)
|
||||
|
||||
// compression block flags
|
||||
#define COMP_STATEMENTS 1
|
||||
#define COMP_DEFS 2
|
||||
#define COMP_FIELDS 4
|
||||
#define COMP_FUNCTIONS 8
|
||||
#define COMP_STRINGS 16
|
||||
#define COMP_GLOBALS 32
|
||||
#define COMP_LINENUMS 64
|
||||
#define COMP_TYPES 128
|
||||
#define MAX_PARMS 8
|
||||
|
||||
// 16-bit mode (get rid of this)
|
||||
#define dstatement_t dstatement16_t
|
||||
#define ddef_t ddef16_t // these should be the same except the string type
|
||||
|
||||
typedef struct statement16_s
|
||||
{
|
||||
word op;
|
||||
short a,b,c;
|
||||
|
||||
} dstatement16_t;
|
||||
|
||||
typedef struct statement32_s
|
||||
{
|
||||
dword op;
|
||||
long a,b,c;
|
||||
|
||||
} dstatement32_t;
|
||||
|
||||
typedef struct ddef16_s
|
||||
{
|
||||
word type; // if DEF_SAVEGLOBAL bit is set
|
||||
// the variable needs to be saved in savegames
|
||||
word ofs;
|
||||
int s_name;
|
||||
} ddef16_t;
|
||||
|
||||
typedef struct ddef32_s
|
||||
{
|
||||
dword type; // if DEF_SAVEGLOBAL bit is set
|
||||
// the variable needs to be saved in savegames
|
||||
dword ofs;
|
||||
int s_name;
|
||||
} ddef32_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int first_statement; // negative numbers are builtins
|
||||
int parm_start;
|
||||
int locals; // total ints of parms + locals
|
||||
int profile; // runtime
|
||||
int s_name;
|
||||
int s_file; // source file defined in
|
||||
int numparms;
|
||||
byte parm_size[MAX_PARMS];
|
||||
} dfunction_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char filename[128];
|
||||
int size;
|
||||
int compsize;
|
||||
int compmethod;
|
||||
int ofs;
|
||||
} dsource_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int version; // version number
|
||||
int crc; // check of header file
|
||||
|
||||
uint ofs_statements; // comp 1
|
||||
uint numstatements; // statement 0 is an error
|
||||
uint ofs_globaldefs; // comp 2
|
||||
uint numglobaldefs;
|
||||
uint ofs_fielddefs; // comp 4
|
||||
uint numfielddefs;
|
||||
uint ofs_functions; // comp 8
|
||||
uint numfunctions; // function 0 is an empty
|
||||
uint ofs_strings; // comp 16
|
||||
uint numstrings; // first string is a null string
|
||||
uint ofs_globals; // comp 32
|
||||
uint numglobals;
|
||||
uint entityfields;
|
||||
|
||||
// version 7 extensions
|
||||
uint ofsfiles; // fmt: (int)numsources, dsource_t[numsources]
|
||||
uint ofslinenums; // numstatements big // comp 64
|
||||
uint ofsbodylessfuncs; // no comp
|
||||
uint numbodylessfuncs;
|
||||
uint ofs_types; // comp 128
|
||||
uint numtypes;
|
||||
uint blockscompressed; // who blocks are compressed (COMP flags)
|
||||
|
||||
int ident; // version 7 id
|
||||
|
||||
} dprograms_t;
|
||||
|
||||
typedef struct dlno_s
|
||||
{
|
||||
int header;
|
||||
int version;
|
||||
|
||||
uint numglobaldefs;
|
||||
uint numglobals;
|
||||
uint numfielddefs;
|
||||
uint numstatements;
|
||||
} dlno_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
.WAD archive format (WhereAllData - WAD)
|
||||
|
||||
List of compressed files, that can be identify only by TYPE_*
|
||||
|
||||
<format>
|
||||
header: dwadinfo_t[dwadinfo_t]
|
||||
file_1: byte[dwadinfo_t[num]->disksize]
|
||||
file_2: byte[dwadinfo_t[num]->disksize]
|
||||
file_3: byte[dwadinfo_t[num]->disksize]
|
||||
...
|
||||
file_n: byte[dwadinfo_t[num]->disksize]
|
||||
infotable dlumpinfo_t[dwadinfo_t->numlumps]
|
||||
========================================================================
|
||||
*/
|
||||
#define IDIWADHEADER (('D'<<24)+('A'<<16)+('W'<<8)+'I') // little-endian "IWAD" doom1 game wad
|
||||
#define IDPWADHEADER (('D'<<24)+('A'<<16)+('W'<<8)+'P') // little-endian "PWAD" doom1 game wad
|
||||
#define IDWAD2HEADER (('2'<<24)+('D'<<16)+('A'<<8)+'W') // little-endian "WAD2" quake1 gfx.wad
|
||||
#define IDWAD3HEADER (('3'<<24)+('D'<<16)+('A'<<8)+'W') // little-endian "WAD3" half-life wads
|
||||
#define IDWAD4HEADER (('4'<<24)+('D'<<16)+('A'<<8)+'W') // little-endian "WAD4" Xash3D wad type
|
||||
|
||||
#define WAD3_NAMELEN 16
|
||||
#define MAX_FILES_IN_WAD 8192
|
||||
|
||||
#define CMP_NONE 0 // compression none
|
||||
#define CMP_LZSS 1 // RLE compression ?
|
||||
#define CMP_ZLIB 2 // zip-archive compression
|
||||
|
||||
#define TYPE_NONE 0 // blank lump
|
||||
#define TYPE_FLMP 59 // doom1 hud picture (doom1 virtual lump)
|
||||
#define TYPE_SND 60 // doom1 wav sound (doom1 virtual lump)
|
||||
#define TYPE_MUS 61 // doom1 music file (doom1 virtual lump)
|
||||
#define TYPE_SKIN 62 // doom1 sprite model (doom1 virtual lump)
|
||||
#define TYPE_FLAT 63 // doom1 wall texture (doom1 virtual lump)
|
||||
#define TYPE_QPAL 64 // quake palette
|
||||
#define TYPE_QTEX 65 // probably was never used
|
||||
#define TYPE_QPIC 66 // quake1 and hl pic (lmp_t)
|
||||
#define TYPE_MIPTEX2 67 // half-life (mip_t) previous TYP_SOUND but never used in quake1
|
||||
#define TYPE_MIPTEX 68 // quake1 (mip_t)
|
||||
#define TYPE_RAW 69 // raw data
|
||||
#define TYPE_QFONT 70 // half-life font (qfont_t)
|
||||
#define TYPE_VPROGS 71 // Xash3D QC compiled progs
|
||||
#define TYPE_SCRIPT 72 // txt script file (e.g. shader)
|
||||
#define TYPE_GFXPIC 73 // any known image format
|
||||
|
||||
#define QCHAR_WIDTH 16
|
||||
#define QFONT_WIDTH 16 // valve fonts used contant sizes
|
||||
#define QFONT_HEIGHT ((128 - 32) / 16)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident; // should be IWAD or WAD2 or WAD3
|
||||
int numlumps; // num files
|
||||
int infotableofs;
|
||||
} dwadinfo_t;
|
||||
|
||||
// doom1 and doom2 lump header
|
||||
typedef struct
|
||||
{
|
||||
int filepos;
|
||||
int size;
|
||||
char name[8];
|
||||
} dlumpfile_t;
|
||||
|
||||
// quake1 and half-life lump header
|
||||
typedef struct
|
||||
{
|
||||
int filepos;
|
||||
int disksize;
|
||||
int size; // uncompressed
|
||||
char type;
|
||||
char compression; // probably not used
|
||||
char pad1;
|
||||
char pad2;
|
||||
char name[16]; // must be null terminated
|
||||
} dlumpinfo_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
STUDIO MODELS
|
||||
|
||||
Studio models are position independent, so the cache manager can move them.
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
// header
|
||||
#define STUDIO_VERSION 10
|
||||
#define IDSTUDIOHEADER (('T'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDST"
|
||||
#define IDSEQGRPHEADER (('Q'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDSQ"
|
||||
|
||||
// studio limits
|
||||
#define MAXSTUDIOTRIANGLES 32768 // max triangles per model
|
||||
#define MAXSTUDIOVERTS 4096 // max vertices per submodel
|
||||
#define MAXSTUDIOSEQUENCES 256 // total animation sequences
|
||||
#define MAXSTUDIOSKINS 128 // total textures
|
||||
#define MAXSTUDIOSRCBONES 512 // bones allowed at source movement
|
||||
#define MAXSTUDIOBONES 128 // total bones actually used
|
||||
#define MAXSTUDIOMODELS 32 // sub-models per model
|
||||
#define MAXSTUDIOBODYPARTS 32 // body parts per submodel
|
||||
#define MAXSTUDIOGROUPS 16 // sequence groups (e.g. barney01.mdl, barney02.mdl, e.t.c)
|
||||
#define MAXSTUDIOANIMATIONS 512 // max frames per sequence
|
||||
#define MAXSTUDIOMESHES 256 // max textures per model
|
||||
#define MAXSTUDIOEVENTS 1024 // events per model
|
||||
#define MAXSTUDIOPIVOTS 256 // pivot points
|
||||
#define MAXSTUDIOBLENDS 8 // max anim blends
|
||||
#define MAXSTUDIOCONTROLLERS 32 // max controllers per model
|
||||
#define MAXSTUDIOATTACHMENTS 32 // max attachments per model
|
||||
|
||||
// model global flags
|
||||
#define STUDIO_STATIC 0x0001 // model without anims
|
||||
#define STUDIO_RAGDOLL 0x0002 // ragdoll animation pose
|
||||
|
||||
// lighting & rendermode options
|
||||
#define STUDIO_NF_FLATSHADE 0x0001
|
||||
#define STUDIO_NF_CHROME 0x0002
|
||||
#define STUDIO_NF_FULLBRIGHT 0x0004
|
||||
#define STUDIO_NF_RESERVED 0x0008 // reserved
|
||||
#define STUDIO_NF_BLENDED 0x0010 // rendering as semiblended
|
||||
#define STUDIO_NF_ADDITIVE 0x0020 // rendering with additive mode
|
||||
#define STUDIO_NF_TRANSPARENT 0x0040 // use texture with alpha channel
|
||||
|
||||
// motion flags
|
||||
#define STUDIO_X 0x0001
|
||||
#define STUDIO_Y 0x0002
|
||||
#define STUDIO_Z 0x0004
|
||||
#define STUDIO_XR 0x0008
|
||||
#define STUDIO_YR 0x0010
|
||||
#define STUDIO_ZR 0x0020
|
||||
#define STUDIO_LX 0x0040
|
||||
#define STUDIO_LY 0x0080
|
||||
#define STUDIO_LZ 0x0100
|
||||
#define STUDIO_AX 0x0200
|
||||
#define STUDIO_AY 0x0400
|
||||
#define STUDIO_AZ 0x0800
|
||||
#define STUDIO_AXR 0x1000
|
||||
#define STUDIO_AYR 0x2000
|
||||
#define STUDIO_AZR 0x4000
|
||||
#define STUDIO_TYPES 0x7FFF
|
||||
#define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance
|
||||
|
||||
// sequence flags
|
||||
#define STUDIO_LOOPING 0x0001
|
||||
|
||||
// render flags
|
||||
#define STUDIO_RENDER 0x0001
|
||||
#define STUDIO_EVENTS 0x0002
|
||||
|
||||
// bone flags
|
||||
#define STUDIO_HAS_NORMALS 0x0001
|
||||
#define STUDIO_HAS_VERTICES 0x0002
|
||||
#define STUDIO_HAS_BBOX 0x0004
|
||||
#define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
|
||||
char name[64];
|
||||
int length;
|
||||
|
||||
vec3_t eyeposition; // ideal eye position
|
||||
vec3_t min; // ideal movement hull size
|
||||
vec3_t max;
|
||||
|
||||
vec3_t bbmin; // clipping bounding box
|
||||
vec3_t bbmax;
|
||||
|
||||
int flags;
|
||||
|
||||
int numbones; // bones
|
||||
int boneindex;
|
||||
|
||||
int numbonecontrollers; // bone controllers
|
||||
int bonecontrollerindex;
|
||||
|
||||
int numhitboxes; // complex bounding boxes
|
||||
int hitboxindex;
|
||||
|
||||
int numseq; // animation sequences
|
||||
int seqindex;
|
||||
|
||||
int numseqgroups; // demand loaded sequences
|
||||
int seqgroupindex;
|
||||
|
||||
int numtextures; // raw textures
|
||||
int textureindex;
|
||||
int texturedataindex;
|
||||
|
||||
int numskinref; // replaceable textures
|
||||
int numskinfamilies;
|
||||
int skinindex;
|
||||
|
||||
int numbodyparts;
|
||||
int bodypartindex;
|
||||
|
||||
int numattachments; // queryable attachable points
|
||||
int attachmentindex;
|
||||
|
||||
int soundtable;
|
||||
int soundindex;
|
||||
int soundgroups;
|
||||
int soundgroupindex;
|
||||
|
||||
int numtransitions; // animation node to animation node transition graph
|
||||
int transitionindex;
|
||||
} studiohdr_t;
|
||||
|
||||
// header for demand loaded sequence group data
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
int version;
|
||||
|
||||
char name[64];
|
||||
int length;
|
||||
} studioseqhdr_t;
|
||||
|
||||
// bones
|
||||
typedef struct
|
||||
{
|
||||
char name[32]; // bone name for symbolic links
|
||||
int parent; // parent bone
|
||||
int flags; // ??
|
||||
int bonecontroller[6]; // bone controller index, -1 == none
|
||||
float value[6]; // default DoF values
|
||||
float scale[6]; // scale for delta DoF values
|
||||
} mstudiobone_t;
|
||||
|
||||
// bone controllers
|
||||
typedef struct
|
||||
{
|
||||
int bone; // -1 == 0
|
||||
int type; // X, Y, Z, XR, YR, ZR, M
|
||||
float start;
|
||||
float end;
|
||||
int rest; // byte index value at rest
|
||||
int index; // 0-3 user set controller, 4 mouth
|
||||
} mstudiobonecontroller_t;
|
||||
|
||||
// intersection boxes
|
||||
typedef struct
|
||||
{
|
||||
int bone;
|
||||
int group; // intersection group
|
||||
vec3_t bbmin; // bounding box
|
||||
vec3_t bbmax;
|
||||
} mstudiobbox_t;
|
||||
|
||||
typedef struct cache_user_s
|
||||
{
|
||||
void *data;
|
||||
} cache_user_t;
|
||||
|
||||
// demand loaded sequence groups
|
||||
typedef struct
|
||||
{
|
||||
char label[32]; // textual name
|
||||
char name[64]; // file name
|
||||
void* cache; // cache index pointer
|
||||
int data; // hack for group 0
|
||||
} mstudioseqgroup_t;
|
||||
|
||||
// sequence descriptions
|
||||
typedef struct
|
||||
{
|
||||
char label[32]; // sequence label (name)
|
||||
|
||||
float fps; // frames per second
|
||||
int flags; // looping/non-looping flags
|
||||
|
||||
int activity;
|
||||
int actweight;
|
||||
|
||||
int numevents;
|
||||
int eventindex;
|
||||
|
||||
int numframes; // number of frames per sequence
|
||||
|
||||
int numpivots; // number of foot pivots
|
||||
int pivotindex;
|
||||
|
||||
int motiontype;
|
||||
int motionbone;
|
||||
vec3_t linearmovement;
|
||||
int automoveposindex;
|
||||
int automoveangleindex;
|
||||
|
||||
vec3_t bbmin; // per sequence bounding box
|
||||
vec3_t bbmax;
|
||||
|
||||
int numblends;
|
||||
int animindex; // mstudioanim_t pointer relative to start of sequence group data
|
||||
// [blend][bone][X, Y, Z, XR, YR, ZR]
|
||||
|
||||
int blendtype[2]; // X, Y, Z, XR, YR, ZR
|
||||
float blendstart[2]; // starting value
|
||||
float blendend[2]; // ending value
|
||||
int blendparent;
|
||||
|
||||
int seqgroup; // sequence group for demand loading
|
||||
|
||||
int entrynode; // transition node at entry
|
||||
int exitnode; // transition node at exit
|
||||
int nodeflags; // transition rules
|
||||
|
||||
int nextseq; // auto advancing sequences
|
||||
} mstudioseqdesc_t;
|
||||
|
||||
// events
|
||||
typedef struct
|
||||
{
|
||||
int frame;
|
||||
int event;
|
||||
int type;
|
||||
char options[64];
|
||||
} mstudioevent_t;
|
||||
|
||||
|
||||
// pivots
|
||||
typedef struct
|
||||
{
|
||||
vec3_t org; // pivot point
|
||||
int start;
|
||||
int end;
|
||||
} mstudiopivot_t;
|
||||
|
||||
// attachment
|
||||
typedef struct
|
||||
{
|
||||
char name[32];
|
||||
int type;
|
||||
int bone;
|
||||
vec3_t org; // attachment point
|
||||
vec3_t vectors[3];
|
||||
} mstudioattachment_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short offset[6];
|
||||
} mstudioanim_t;
|
||||
|
||||
// animation frames
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
byte valid;
|
||||
byte total;
|
||||
} num;
|
||||
short value;
|
||||
} mstudioanimvalue_t;
|
||||
|
||||
|
||||
// body part index
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
int nummodels;
|
||||
int base;
|
||||
int modelindex; // index into models array
|
||||
} mstudiobodyparts_t;
|
||||
|
||||
|
||||
// skin info
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
int flags;
|
||||
int width;
|
||||
int height;
|
||||
int index;
|
||||
} mstudiotexture_t;
|
||||
|
||||
// skin families
|
||||
// short index[skinfamilies][skinref] // skingroup info
|
||||
|
||||
// studio models
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
|
||||
int type;
|
||||
float boundingradius;
|
||||
|
||||
int nummesh;
|
||||
int meshindex;
|
||||
|
||||
int numverts; // number of unique vertices
|
||||
int vertinfoindex; // vertex bone info
|
||||
int vertindex; // vertex vec3_t
|
||||
int numnorms; // number of unique surface normals
|
||||
int norminfoindex; // normal bone info
|
||||
int normindex; // normal vec3_t
|
||||
|
||||
int numgroups; // deformation groups
|
||||
int groupindex;
|
||||
} mstudiomodel_t;
|
||||
|
||||
// meshes
|
||||
typedef struct
|
||||
{
|
||||
int numtris;
|
||||
int triindex;
|
||||
int skinref;
|
||||
int numnorms; // per mesh normals
|
||||
int normindex; // normal vec3_t
|
||||
} mstudiomesh_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
SAVE FILE
|
||||
|
||||
included global, and both (client & server) pent list
|
||||
==============================================================================
|
||||
*/
|
||||
#define SAVE_VERSION 3
|
||||
#define IDSAVEHEADER (('E'<<24)+('V'<<16)+('A'<<8)+'S') // little-endian "SAVE"
|
||||
|
||||
#define LUMP_COMMENTS 0 // map comments (name, savetime)
|
||||
#define LUMP_CFGSTRING 1 // client info strings
|
||||
#define LUMP_AREASTATE 2 // area portals state
|
||||
#define LUMP_GAMESTATE 3 // progs global state (compressed)
|
||||
#define LUMP_MAPNAME 4 // map name
|
||||
#define LUMP_GAMECVARS 5 // contain game comment and all cvar state
|
||||
#define LUMP_GAMEENTS 6 // ents state (compressed)
|
||||
#define LUMP_SNAPSHOT 7 // rgb32 image snapshot (128x128)
|
||||
#define SAVE_NUMLUMPS 8 // header size
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
lump_t lumps[SAVE_NUMLUMPS];
|
||||
} dsavehdr_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
char value[MAX_QPATH];
|
||||
} dsavecvar_t;
|
||||
|
||||
#endif//REF_DFILES_H
|
File diff suppressed because it is too large
Load Diff
412
public/stdapi.h
412
public/stdapi.h
|
@ -1,412 +0,0 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// stdapi.h - generic shared interfaces
|
||||
//=======================================================================
|
||||
#ifndef REF_SYSTEM_H
|
||||
#define REF_SYSTEM_H
|
||||
|
||||
#include "stdref.h"
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
STDLIB SYSTEM INTERFACE
|
||||
==============================================================================
|
||||
*/
|
||||
typedef struct stdilib_api_s
|
||||
{
|
||||
// interface validator
|
||||
size_t api_size; // must matched with sizeof(stdlib_api_t)
|
||||
|
||||
// base events
|
||||
void (*print)( const char *msg ); // basic text message
|
||||
void (*printf)( const char *msg, ... ); // formatted text message
|
||||
void (*dprintf)( int level, const char *msg, ...); // developer text message
|
||||
void (*error)( const char *msg, ... ); // abnormal termination with message
|
||||
void (*abort)( const char *msg, ... ); // normal tremination with message
|
||||
void (*exit)( void ); // normal silent termination
|
||||
void (*sleep)( int msec ); // sleep for some msec
|
||||
char *(*clipboard)( void ); // get clipboard data
|
||||
void (*queevent)( dword time, ev_type_t type, int value, int value2, int length, void *ptr );
|
||||
sys_event_t (*getevent)( void ); // get system events
|
||||
|
||||
// crclib.c funcs
|
||||
void (*crc_init)(word *crcvalue); // set initial crc value
|
||||
word (*crc_block)(byte *start, int count); // calculate crc block
|
||||
void (*crc_process)(word *crcvalue, byte data); // process crc byte
|
||||
byte (*crc_sequence)(byte *base, int length, int sequence); // calculate crc for sequence
|
||||
uint (*crc_blockchecksum)(void *buffer, int length); // map checksum
|
||||
uint (*crc_blockchecksumkey)(void *buf, int len, int key); // process key checksum
|
||||
|
||||
// memlib.c funcs
|
||||
void (*memcpy)(void *dest, const void *src, size_t size, const char *file, int line);
|
||||
void *(*realloc)(byte *pool, void *mem, size_t size, const char *file, int line);
|
||||
void (*move)(byte *pool, void **dest, void *src, size_t size, const char *file, int line); // not a memmove
|
||||
void *(*malloc)(byte *pool, size_t size, const char *file, int line);
|
||||
void (*free)(void *data, const char *file, int line);
|
||||
|
||||
// xash memlib extension - memory pools
|
||||
byte *(*mallocpool)(const char *name, const char *file, int line);
|
||||
void (*freepool)(byte **poolptr, const char *file, int line);
|
||||
void (*clearpool)(byte *poolptr, const char *file, int line);
|
||||
void (*memcheck)(const char *file, int line); // check memory pools for consistensy
|
||||
|
||||
// xash memlib extension - memory arrays
|
||||
byte *(*newarray)( byte *pool, size_t elementsize, int count, const char *file, int line );
|
||||
void (*delarray)( byte *array, const char *file, int line );
|
||||
void *(*newelement)( byte *array, const char *file, int line );
|
||||
void (*delelement)( byte *array, void *element, const char *file, int line );
|
||||
void *(*getelement)( byte *array, size_t index );
|
||||
size_t (*arraysize)( byte *arrayptr );
|
||||
|
||||
// network.c funcs
|
||||
void (*NET_Init)( void );
|
||||
void (*NET_Shutdown)( void );
|
||||
void (*NET_ShowIP)( void );
|
||||
void (*NET_Config)( bool net_enable );
|
||||
char *(*NET_AdrToString)( netadr_t a );
|
||||
bool (*NET_IsLANAddress)( netadr_t adr );
|
||||
bool (*NET_StringToAdr)( const char *s, netadr_t *a );
|
||||
void (*NET_SendPacket)( int length, const void *data, netadr_t to );
|
||||
|
||||
// common functions
|
||||
void (*Com_InitRootDir)( char *path ); // init custom rootdir
|
||||
void (*Com_LoadGameInfo)( const char *filename ); // gate game info from script file
|
||||
void (*Com_AddGameHierarchy)(const char *dir); // add base directory in search list
|
||||
int (*Com_CheckParm)( const char *parm ); // check parm in cmdline
|
||||
bool (*Com_GetParm)( char *parm, char *out ); // get parm from cmdline
|
||||
void (*Com_FileBase)(const char *in, char *out); // get filename without path & ext
|
||||
bool (*Com_FileExists)(const char *filename); // return true if file exist
|
||||
long (*Com_FileSize)(const char *filename); // same as Com_FileExists but return filesize
|
||||
long (*Com_FileTime)(const char *filename); // same as Com_FileExists but return filetime
|
||||
const char *(*Com_FileExtension)(const char *in); // return extension of file
|
||||
const char *(*Com_RemovePath)(const char *in); // return file without path
|
||||
void (*Com_StripExtension)(char *path); // remove extension if present
|
||||
void (*Com_StripFilePath)(const char* const src, char* dst);// get file path without filename.ext
|
||||
void (*Com_DefaultExtension)(char *path, const char *ext ); // append extension if not present
|
||||
void (*Com_ClearSearchPath)( void ); // delete all search pathes
|
||||
void (*Com_CreateThread)(int, bool, void(*fn)(int)); // run individual thread
|
||||
void (*Com_ThreadLock)( void ); // lock current thread
|
||||
void (*Com_ThreadUnlock)( void ); // unlock numthreads
|
||||
int (*Com_NumThreads)( void ); // returns count of active threads
|
||||
bool (*Com_LoadScript)(const char *name,char *buf,int size);// load script into stack from file or bufer
|
||||
bool (*Com_AddScript)(const char *name,char *buf, int size);// include script from file or buffer
|
||||
void (*Com_ResetScript)( void ); // reset current script state
|
||||
char *(*Com_ReadToken)( bool newline ); // get next token on a line or newline
|
||||
bool (*Com_TryToken)( void ); // return 1 if have token on a line
|
||||
void (*Com_FreeToken)( void ); // free current token to may get it again
|
||||
void (*Com_SkipToken)( void ); // skip current token and jump into newline
|
||||
bool (*Com_MatchToken)( const char *match ); // compare current token with user keyword
|
||||
bool (*Com_ParseToken_Simple)(const char **data_p); // basic parse (can't handle single characters)
|
||||
char *(*Com_ParseToken)(const char **data ); // parse token from char buffer
|
||||
char *(*Com_ParseWord)( const char **data ); // parse word from char buffer
|
||||
search_t *(*Com_Search)(const char *pattern, int casecmp ); // returned list of found files
|
||||
bool (*Com_Filter)(char *filter, char *name, int casecmp ); // compare keyword by mask with filter
|
||||
uint (*Com_HashKey)( const char *string, uint hashSize ); // returns hash key for a string
|
||||
char *com_token; // contains current token
|
||||
|
||||
// console variables
|
||||
cvar_t *(*Cvar_Get)(const char *name, const char *value, int flags, const char *desc);
|
||||
void (*Cvar_LookupVars)( int checkbit, char *buffer, void *ptr, cvarcmd_t callback );
|
||||
void (*Cvar_SetString)( const char *name, const char *value );
|
||||
void (*Cvar_SetLatched)( const char *name, const char *value);
|
||||
void (*Cvar_FullSet)( char *name, char *value, int flags );
|
||||
void (*Cvar_SetValue )( const char *name, float value);
|
||||
float (*Cvar_GetValue )(const char *name);
|
||||
char *(*Cvar_GetString)(const char *name);
|
||||
cvar_t *(*Cvar_FindVar)(const char *name);
|
||||
bool userinfo_modified; // tell to client about userinfo modified
|
||||
|
||||
// console commands
|
||||
void (*Cmd_Exec)(int exec_when, const char *text); // process cmd buffer
|
||||
uint (*Cmd_Argc)( void );
|
||||
char *(*Cmd_Args)( void );
|
||||
char *(*Cmd_Argv)( uint arg );
|
||||
void (*Cmd_LookupCmds)( char *buffer, void *ptr, cvarcmd_t callback );
|
||||
void (*Cmd_AddCommand)(const char *name, xcommand_t function, const char *desc);
|
||||
void (*Cmd_TokenizeString)(const char *text_in);
|
||||
void (*Cmd_DelCommand)(const char *name);
|
||||
|
||||
// real filesystem
|
||||
file_t *(*fopen)(const char* path, const char* mode); // same as fopen
|
||||
int (*fclose)(file_t* file); // same as fclose
|
||||
long (*fwrite)(file_t* file, const void* data, size_t datasize); // same as fwrite
|
||||
long (*fread)(file_t* file, void* buffer, size_t buffersize); // same as fread, can see trough pakfile
|
||||
int (*fprint)(file_t* file, const char *msg); // printed message into file
|
||||
int (*fprintf)(file_t* file, const char* format, ...); // same as fprintf
|
||||
int (*fgets)(file_t* file, byte *string, size_t bufsize ); // like a fgets, but can return EOF
|
||||
int (*fseek)(file_t* file, fs_offset_t offset, int whence); // fseek, can seek in packfiles too
|
||||
long (*ftell)(file_t* file); // like a ftell
|
||||
|
||||
// virtual filesystem
|
||||
vfile_t *(*vfcreate)(byte *buffer, size_t buffsize); // create virtual stream
|
||||
vfile_t *(*vfopen)(file_t *handle, const char* mode); // virtual fopen
|
||||
file_t *(*vfclose)(vfile_t* file); // free buffer or write dump
|
||||
long (*vfwrite)(vfile_t* file, const void* buf, size_t datasize); // write into buffer
|
||||
long (*vfread)(vfile_t* file, void* buffer, size_t buffersize); // read from buffer
|
||||
int (*vfgets)(vfile_t* file, byte *string, size_t bufsize ); // read text line
|
||||
int (*vfprint)(vfile_t* file, const char *msg); // write message
|
||||
int (*vfprintf)(vfile_t* file, const char* format, ...); // write formatted message
|
||||
int (*vfseek)(vfile_t* file, fs_offset_t offset, int whence); // fseek, can seek in packfiles too
|
||||
bool (*vfunpack)( void* comp, size_t size1, void **buf, size_t size2);// deflate zipped buffer
|
||||
long (*vftell)(vfile_t* file); // like a ftell
|
||||
bool (*vfeof)( vfile_t* file); // like a feof
|
||||
|
||||
// filesystem simply user interface
|
||||
byte *(*Com_LoadFile)(const char *path, long *filesize ); // load file into heap
|
||||
bool (*Com_WriteFile)(const char *path, const void *data, long len ); // write file into disk
|
||||
bool (*Com_LoadLibrary)( dll_info_t *dll ); // load library
|
||||
bool (*Com_FreeLibrary)( dll_info_t *dll ); // free library
|
||||
void*(*Com_GetProcAddress)( dll_info_t *dll, const char* name ); // gpa
|
||||
double (*Com_DoubleTime)( void ); // hi-res timer
|
||||
dword (*Com_Milliseconds)( void ); // hi-res timer
|
||||
|
||||
// random generator
|
||||
long (*Com_RandomLong)( long lMin, long lMax ); // returns random integer
|
||||
float (*Com_RandomFloat)( float fMin, float fMax ); // returns random float
|
||||
|
||||
// stdlib.c funcs
|
||||
void (*strnupr)(const char *in, char *out, size_t size_out); // convert string to upper case
|
||||
void (*strnlwr)(const char *in, char *out, size_t size_out); // convert string to lower case
|
||||
void (*strupr)(const char *in, char *out); // convert string to upper case
|
||||
void (*strlwr)(const char *in, char *out); // convert string to lower case
|
||||
int (*strlen)( const char *string ); // returns string real length
|
||||
int (*cstrlen)( const char *string ); // return string length without color prefixes
|
||||
char (*toupper)(const char in ); // convert one charcster to upper case
|
||||
char (*tolower)(const char in ); // convert one charcster to lower case
|
||||
size_t (*strncat)(char *dst, const char *src, size_t n); // add new string at end of buffer
|
||||
size_t (*strcat)(char *dst, const char *src); // add new string at end of buffer
|
||||
size_t (*strncpy)(char *dst, const char *src, size_t n); // copy string to existing buffer
|
||||
size_t (*strcpy)(char *dst, const char *src); // copy string to existing buffer
|
||||
char *(*stralloc)(const char *in,const char *file,int line); // create buffer and copy string here
|
||||
int (*atoi)(const char *str); // convert string to integer
|
||||
float (*atof)(const char *str); // convert string to float
|
||||
void (*atov)( float *dst, const char *src, size_t n ); // convert string to vector
|
||||
char *(*strchr)(const char *s, char c); // find charcster in string at left side
|
||||
char *(*strrchr)(const char *s, char c); // find charcster in string at right side
|
||||
int (*strnicmp)(const char *s1, const char *s2, int n); // compare strings with case insensative
|
||||
int (*stricmp)(const char *s1, const char *s2); // compare strings with case insensative
|
||||
int (*strncmp)(const char *s1, const char *s2, int n); // compare strings with case sensative
|
||||
int (*strcmp)(const char *s1, const char *s2); // compare strings with case sensative
|
||||
char *(*stristr)( const char *s1, const char *s2 ); // find s2 in s1 with case insensative
|
||||
char *(*strstr)( const char *s1, const char *s2 ); // find s2 in s1 with case sensative
|
||||
size_t (*strpack)( byte *buf, size_t pos, char *s1, int n ); // include string into buffer (same as strncat)
|
||||
size_t (*strunpack)( byte *buf, size_t pos, char *s1 ); // extract string from buffer
|
||||
int (*vsprintf)(char *buf, const char *fmt, va_list args); // format message
|
||||
int (*sprintf)(char *buffer, const char *format, ...); // print into buffer
|
||||
char *(*va)(const char *format, ...); // print into temp buffer
|
||||
int (*vsnprintf)(char *buf, size_t size, const char *fmt, va_list args); // format message
|
||||
int (*snprintf)(char *buffer, size_t buffersize, const char *format, ...); // print into buffer
|
||||
const char* (*timestamp)( int format ); // returns current time stamp
|
||||
|
||||
// misc utils
|
||||
gameinfo_t *GameInfo; // user game info (filled by engine)
|
||||
|
||||
} stdlib_api_t;
|
||||
|
||||
#ifndef LAUNCH_DLL
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
STDLIB GENERIC ALIAS NAMES
|
||||
don't add aliases for launch.dll so it will be conflicted width real names
|
||||
==============================================================================
|
||||
*/
|
||||
/*
|
||||
==========================================
|
||||
memory manager funcs
|
||||
==========================================
|
||||
*/
|
||||
#define Mem_Alloc(pool, size) com.malloc(pool, size, __FILE__, __LINE__)
|
||||
#define Mem_Realloc(pool, ptr, size) com.realloc(pool, ptr, size, __FILE__, __LINE__)
|
||||
#define Mem_Move(pool, ptr, data, size) com.move(pool, ptr, data, size, __FILE__, __LINE__)
|
||||
#define Mem_Free(mem) com.free(mem, __FILE__, __LINE__)
|
||||
#define Mem_AllocPool(name) com.mallocpool(name, __FILE__, __LINE__)
|
||||
#define Mem_FreePool(pool) com.freepool(pool, __FILE__, __LINE__)
|
||||
#define Mem_EmptyPool(pool) com.clearpool(pool, __FILE__, __LINE__)
|
||||
#define Mem_Copy(dest, src, size ) com.memcpy(dest, src, size, __FILE__, __LINE__)
|
||||
#define Mem_Check() com.memcheck(__FILE__, __LINE__)
|
||||
#define Mem_CreateArray( p, s, n ) com.newarray( p, s, n, __FILE__, __LINE__)
|
||||
#define Mem_RemoveArray( array ) com.delarray( array, __FILE__, __LINE__)
|
||||
#define Mem_AllocElement( array ) com.newelement( array, __FILE__, __LINE__)
|
||||
#define Mem_FreeElement( array, el ) com.delelement( array, el, __FILE__, __LINE__ )
|
||||
#define Mem_GetElement( array, idx ) com.getelement( array, idx )
|
||||
#define Mem_ArraySize( array ) com.arraysize( array )
|
||||
|
||||
/*
|
||||
==========================================
|
||||
parsing manager funcs
|
||||
==========================================
|
||||
*/
|
||||
#define Com_ParseToken com.Com_ParseToken
|
||||
#define Com_ParseWord com.Com_ParseWord
|
||||
#define Com_SimpleGetToken com.Com_ParseToken_Simple
|
||||
#define Com_Filter com.Com_Filter
|
||||
#define Com_HashKey com.Com_HashKey
|
||||
#define Com_LoadScript com.Com_LoadScript
|
||||
#define Com_IncludeScript com.Com_AddScript
|
||||
#define Com_ResetScript com.Com_ResetScript
|
||||
#define Com_GetToken com.Com_ReadToken
|
||||
#define Com_TryToken com.Com_TryToken
|
||||
#define Com_FreeToken com.Com_FreeToken
|
||||
#define Com_SkipToken com.Com_SkipToken
|
||||
#define Com_MatchToken com.Com_MatchToken
|
||||
#define com_token com.com_token
|
||||
#define g_TXcommand com.GameInfo->TXcommand // get rid of this
|
||||
|
||||
/*
|
||||
===========================================
|
||||
filesystem manager
|
||||
===========================================
|
||||
*/
|
||||
#define FS_AddGameHierarchy com.Com_AddGameHierarchy
|
||||
#define FS_LoadGameInfo com.Com_LoadGameInfo
|
||||
#define FS_InitRootDir com.Com_InitRootDir
|
||||
#define FS_LoadFile com.Com_LoadFile
|
||||
#define FS_Search com.Com_Search
|
||||
#define FS_WriteFile com.Com_WriteFile
|
||||
#define FS_Open( path, mode ) com.fopen( path, mode )
|
||||
#define FS_Read( file, buffer, size ) com.fread( file, buffer, size )
|
||||
#define FS_Write( file, buffer, size ) com.fwrite( file, buffer, size )
|
||||
#define FS_StripExtension( path ) com.Com_StripExtension( path )
|
||||
#define FS_ExtractFilePath( src, dest) com.Com_StripFilePath( src, dest )
|
||||
#define FS_DefaultExtension com.Com_DefaultExtension
|
||||
#define FS_FileExtension( ext ) com.Com_FileExtension( ext )
|
||||
#define FS_FileExists( file ) com.Com_FileExists( file )
|
||||
#define FS_FileSize( file ) com.Com_FileSize( file )
|
||||
#define FS_FileTime( file ) com.Com_FileTime( file )
|
||||
#define FS_Close( file ) com.fclose( file )
|
||||
#define FS_FileBase( x, y ) com.Com_FileBase( x, y )
|
||||
#define FS_Printf com.fprintf
|
||||
#define FS_Print com.fprint
|
||||
#define FS_Seek com.fseek
|
||||
#define FS_Tell com.ftell
|
||||
#define FS_Gets com.fgets
|
||||
#define FS_Gamedir com.GameInfo->gamedir
|
||||
#define FS_Title com.GameInfo->title
|
||||
#define FS_ClearSearchPath com.Com_ClearSearchPath
|
||||
#define FS_CheckParm com.Com_CheckParm
|
||||
#define FS_GetParmFromCmdLine com.Com_GetParm
|
||||
|
||||
/*
|
||||
===========================================
|
||||
network messages
|
||||
===========================================
|
||||
*/
|
||||
#define NET_Init com.NET_Init
|
||||
#define NET_Shutdown com.NET_Shutdown
|
||||
#define NET_ShowIP com.NET_ShowIP
|
||||
#define NET_Config com.NET_Config
|
||||
#define NET_AdrToString com.NET_AdrToString
|
||||
#define NET_IsLANAddress com.NET_IsLANAddress
|
||||
#define Sys_StringToAdr com.NET_StringToAdr
|
||||
#define Sys_SendPacket com.NET_SendPacket
|
||||
|
||||
/*
|
||||
===========================================
|
||||
console variables
|
||||
===========================================
|
||||
*/
|
||||
#define Cvar_Get com.Cvar_Get
|
||||
#define Cvar_LookupVars com.Cvar_LookupVars
|
||||
#define Cvar_Set com.Cvar_SetString
|
||||
#define Cvar_FullSet com.Cvar_FullSet
|
||||
#define Cvar_SetLatched com.Cvar_SetLatched
|
||||
#define Cvar_SetValue com.Cvar_SetValue
|
||||
#define Cvar_VariableValue com.Cvar_GetValue
|
||||
#define Cvar_VariableString com.Cvar_GetString
|
||||
#define Cvar_FindVar com.Cvar_FindVar
|
||||
#define userinfo_modified com.userinfo_modified
|
||||
|
||||
/*
|
||||
===========================================
|
||||
console commands
|
||||
===========================================
|
||||
*/
|
||||
#define Cbuf_ExecuteText com.Cmd_Exec
|
||||
#define Cbuf_AddText( text ) com.Cmd_Exec( EXEC_APPEND, text )
|
||||
#define Cmd_ExecuteString( text ) com.Cmd_Exec( EXEC_NOW, text )
|
||||
#define Cbuf_InsertText( text ) com.Cmd_Exec( EXEC_INSERT, text )
|
||||
#define Cbuf_Execute() com.Cmd_Exec( EXEC_NOW, NULL )
|
||||
|
||||
#define Cmd_Argc com.Cmd_Argc
|
||||
#define Cmd_Args com.Cmd_Args
|
||||
#define Cmd_Argv com.Cmd_Argv
|
||||
#define Cmd_TokenizeString com.Cmd_TokenizeString
|
||||
#define Cmd_LookupCmds com.Cmd_LookupCmds
|
||||
#define Cmd_AddCommand com.Cmd_AddCommand
|
||||
#define Cmd_RemoveCommand com.Cmd_DelCommand
|
||||
|
||||
/*
|
||||
===========================================
|
||||
virtual filesystem manager
|
||||
===========================================
|
||||
*/
|
||||
#define VFS_Create com.vfcreate
|
||||
#define VFS_Open com.vfopen
|
||||
#define VFS_Write com.vfwrite
|
||||
#define VFS_Read com.vfread
|
||||
#define VFS_Print com.vfprint
|
||||
#define VFS_Printf com.vfprintf
|
||||
#define VFS_Gets com.vfgets
|
||||
#define VFS_Seek com.vfseek
|
||||
#define VFS_Tell com.vftell
|
||||
#define VFS_Eof com.vfeof
|
||||
#define VFS_Close com.vfclose
|
||||
#define VFS_Unpack com.vfunpack
|
||||
|
||||
/*
|
||||
===========================================
|
||||
crclib manager
|
||||
===========================================
|
||||
*/
|
||||
#define CRC_Init com.crc_init
|
||||
#define CRC_Block com.crc_block
|
||||
#define CRC_ProcessByte com.crc_process
|
||||
#define CRC_Sequence com.crc_sequence
|
||||
#define Com_BlockChecksum com.crc_blockchecksum
|
||||
#define Com_BlockChecksumKey com.crc_blockchecksumkey
|
||||
|
||||
/*
|
||||
===========================================
|
||||
misc utils
|
||||
===========================================
|
||||
*/
|
||||
#define GI com.GameInfo
|
||||
#define Msg com.printf
|
||||
#define MsgDev com.dprintf
|
||||
#define Sys_LoadLibrary com.Com_LoadLibrary
|
||||
#define Sys_FreeLibrary com.Com_FreeLibrary
|
||||
#define Sys_GetProcAddress com.Com_GetProcAddress
|
||||
#define Sys_Sleep com.sleep
|
||||
#define Sys_Print com.print
|
||||
#define Sys_GetEvent com.getevent
|
||||
#define Sys_QueEvent com.queevent
|
||||
#define Sys_GetClipboardData com.clipboard
|
||||
#define Sys_Quit com.exit
|
||||
#define Sys_Break com.abort
|
||||
#define Sys_DoubleTime com.Com_DoubleTime
|
||||
#define Sys_Milliseconds com.Com_Milliseconds
|
||||
#define GetNumThreads com.Com_NumThreads
|
||||
#define ThreadLock com.Com_ThreadLock
|
||||
#define ThreadUnlock com.Com_ThreadUnlock
|
||||
#define RunThreadsOnIndividual com.Com_CreateThread
|
||||
#define Com_RandomLong com.Com_RandomLong
|
||||
#define Com_RandomFloat com.Com_RandomFloat
|
||||
|
||||
/*
|
||||
===========================================
|
||||
stdlib function names that not across with windows stdlib
|
||||
===========================================
|
||||
*/
|
||||
#define timestamp com.timestamp
|
||||
#define copystring( str ) com.stralloc( str, __FILE__, __LINE__ )
|
||||
#define strcasecmp com.stricmp
|
||||
#define strncasecmp com.strnicmp
|
||||
#define strlower com.strlwr
|
||||
#define stristr com.stristr
|
||||
#define va com.va
|
||||
|
||||
#endif//LAUNCH_DLL
|
||||
|
||||
#endif//REF_SYSTEM_H
|
1217
public/stdref.h
1217
public/stdref.h
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// r_backend.c - open gl backend utilites
|
||||
// gl_backend.c - open gl backend utilites
|
||||
//=======================================================================
|
||||
|
||||
#include "gl_local.h"
|
||||
|
@ -23,7 +23,8 @@ typedef struct
|
|||
int maximize;
|
||||
} glmode_t;
|
||||
|
||||
glmode_t modes[] = {
|
||||
glmode_t modes[] =
|
||||
{
|
||||
{"GL_NEAREST", GL_NEAREST, GL_NEAREST},
|
||||
{"GL_LINEAR", GL_LINEAR, GL_LINEAR},
|
||||
{"GL_NEAREST_MIPMAP_NEAREST", GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST},
|
||||
|
@ -38,7 +39,8 @@ typedef struct
|
|||
int mode;
|
||||
}gltmode_t;
|
||||
|
||||
gltmode_t gl_alpha_modes[] = {
|
||||
gltmode_t gl_alpha_modes[] =
|
||||
{
|
||||
{"default", 4},
|
||||
{"GL_RGBA", GL_RGBA},
|
||||
{"GL_RGBA8", GL_RGBA8},
|
||||
|
@ -47,7 +49,8 @@ gltmode_t gl_alpha_modes[] = {
|
|||
{"GL_RGBA2", GL_RGBA2},
|
||||
};
|
||||
|
||||
gltmode_t gl_solid_modes[] = {
|
||||
gltmode_t gl_solid_modes[] =
|
||||
{
|
||||
{"default", 3},
|
||||
{"GL_RGB", GL_RGB},
|
||||
{"GL_RGB8", GL_RGB8},
|
||||
|
@ -56,6 +59,268 @@ gltmode_t gl_solid_modes[] = {
|
|||
{"GL_R3_G3_B2", GL_R3_G3_B2},
|
||||
};
|
||||
|
||||
|
||||
static dllfunc_t wglswapintervalfuncs[] =
|
||||
{
|
||||
{"wglSwapIntervalEXT", (void **) &pwglSwapIntervalEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t opengl_110funcs[] =
|
||||
{
|
||||
{"glClearColor", (void **) &pglClearColor},
|
||||
{"glClear", (void **) &pglClear},
|
||||
{"glAlphaFunc", (void **) &pglAlphaFunc},
|
||||
{"glBlendFunc", (void **) &pglBlendFunc},
|
||||
{"glCullFace", (void **) &pglCullFace},
|
||||
{"glDrawBuffer", (void **) &pglDrawBuffer},
|
||||
{"glReadBuffer", (void **) &pglReadBuffer},
|
||||
{"glEnable", (void **) &pglEnable},
|
||||
{"glDisable", (void **) &pglDisable},
|
||||
{"glEnableClientState", (void **) &pglEnableClientState},
|
||||
{"glDisableClientState", (void **) &pglDisableClientState},
|
||||
{"glGetBooleanv", (void **) &pglGetBooleanv},
|
||||
{"glGetDoublev", (void **) &pglGetDoublev},
|
||||
{"glGetFloatv", (void **) &pglGetFloatv},
|
||||
{"glGetIntegerv", (void **) &pglGetIntegerv},
|
||||
{"glGetError", (void **) &pglGetError},
|
||||
{"glGetString", (void **) &pglGetString},
|
||||
{"glFinish", (void **) &pglFinish},
|
||||
{"glFlush", (void **) &pglFlush},
|
||||
{"glClearDepth", (void **) &pglClearDepth},
|
||||
{"glDepthFunc", (void **) &pglDepthFunc},
|
||||
{"glDepthMask", (void **) &pglDepthMask},
|
||||
{"glDepthRange", (void **) &pglDepthRange},
|
||||
{"glDrawElements", (void **) &pglDrawElements},
|
||||
{"glColorMask", (void **) &pglColorMask},
|
||||
{"glVertexPointer", (void **) &pglVertexPointer},
|
||||
{"glNormalPointer", (void **) &pglNormalPointer},
|
||||
{"glColorPointer", (void **) &pglColorPointer},
|
||||
{"glTexCoordPointer", (void **) &pglTexCoordPointer},
|
||||
{"glArrayElement", (void **) &pglArrayElement},
|
||||
{"glColor3f", (void **) &pglColor3f},
|
||||
{"glColor3fv", (void **) &pglColor3fv},
|
||||
{"glColor4f", (void **) &pglColor4f},
|
||||
{"glColor4fv", (void **) &pglColor4fv},
|
||||
{"glColor4ubv", (void **) &pglColor4ubv},
|
||||
{"glTexCoord1f", (void **) &pglTexCoord1f},
|
||||
{"glTexCoord2f", (void **) &pglTexCoord2f},
|
||||
{"glTexCoord3f", (void **) &pglTexCoord3f},
|
||||
{"glTexCoord4f", (void **) &pglTexCoord4f},
|
||||
{"glTexGenf", (void **) &pglTexGenf},
|
||||
{"glTexGenfv", (void **) &pglTexGenfv},
|
||||
{"glVertex2f", (void **) &pglVertex2f},
|
||||
{"glVertex3f", (void **) &pglVertex3f},
|
||||
{"glVertex3fv", (void **) &pglVertex3fv},
|
||||
{"glBegin", (void **) &pglBegin},
|
||||
{"glEnd", (void **) &pglEnd},
|
||||
{"glLineWidth", (void**) &pglLineWidth},
|
||||
{"glPointSize", (void**) &pglPointSize},
|
||||
{"glMatrixMode", (void **) &pglMatrixMode},
|
||||
{"glOrtho", (void **) &pglOrtho},
|
||||
{"glFrustum", (void **) &pglFrustum},
|
||||
{"glViewport", (void **) &pglViewport},
|
||||
{"glPushMatrix", (void **) &pglPushMatrix},
|
||||
{"glPopMatrix", (void **) &pglPopMatrix},
|
||||
{"glLoadIdentity", (void **) &pglLoadIdentity},
|
||||
{"glLoadMatrixd", (void **) &pglLoadMatrixd},
|
||||
{"glLoadMatrixf", (void **) &pglLoadMatrixf},
|
||||
{"glMultMatrixd", (void **) &pglMultMatrixd},
|
||||
{"glMultMatrixf", (void **) &pglMultMatrixf},
|
||||
{"glRotated", (void **) &pglRotated},
|
||||
{"glRotatef", (void **) &pglRotatef},
|
||||
{"glScaled", (void **) &pglScaled},
|
||||
{"glScalef", (void **) &pglScalef},
|
||||
{"glTranslated", (void **) &pglTranslated},
|
||||
{"glTranslatef", (void **) &pglTranslatef},
|
||||
{"glReadPixels", (void **) &pglReadPixels},
|
||||
{"glStencilFunc", (void **) &pglStencilFunc},
|
||||
{"glStencilMask", (void **) &pglStencilMask},
|
||||
{"glStencilOp", (void **) &pglStencilOp},
|
||||
{"glClearStencil", (void **) &pglClearStencil},
|
||||
{"glTexEnvf", (void **) &pglTexEnvf},
|
||||
{"glTexEnvfv", (void **) &pglTexEnvfv},
|
||||
{"glTexEnvi", (void **) &pglTexEnvi},
|
||||
{"glTexParameterf", (void **) &pglTexParameterf},
|
||||
{"glTexParameterfv", (void **) &pglTexParameterfv},
|
||||
{"glTexParameteri", (void **) &pglTexParameteri},
|
||||
{"glHint", (void **) &pglHint},
|
||||
{"glPixelStoref", (void **) &pglPixelStoref},
|
||||
{"glPixelStorei", (void **) &pglPixelStorei},
|
||||
{"glGenTextures", (void **) &pglGenTextures},
|
||||
{"glDeleteTextures", (void **) &pglDeleteTextures},
|
||||
{"glBindTexture", (void **) &pglBindTexture},
|
||||
{"glTexImage1D", (void **) &pglTexImage1D},
|
||||
{"glTexImage2D", (void **) &pglTexImage2D},
|
||||
{"glTexSubImage1D", (void **) &pglTexSubImage1D},
|
||||
{"glTexSubImage2D", (void **) &pglTexSubImage2D},
|
||||
{"glCopyTexImage1D", (void **) &pglCopyTexImage1D},
|
||||
{"glCopyTexImage2D", (void **) &pglCopyTexImage2D},
|
||||
{"glCopyTexSubImage1D", (void **) &pglCopyTexSubImage1D},
|
||||
{"glCopyTexSubImage2D", (void **) &pglCopyTexSubImage2D},
|
||||
{"glScissor", (void **) &pglScissor},
|
||||
{"glPolygonOffset", (void **) &pglPolygonOffset},
|
||||
{"glPolygonMode", (void **) &pglPolygonMode},
|
||||
{"glPolygonStipple", (void **) &pglPolygonStipple},
|
||||
{"glClipPlane", (void **) &pglClipPlane},
|
||||
{"glGetClipPlane", (void **) &pglGetClipPlane},
|
||||
{"glShadeModel", (void **) &pglShadeModel},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t pointparametersfunc[] =
|
||||
{
|
||||
{"glPointParameterfEXT", (void **) &pglPointParameterfEXT},
|
||||
{"glPointParameterfvEXT", (void **) &pglPointParameterfvEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t drawrangeelementsfuncs[] =
|
||||
{
|
||||
{"glDrawRangeElements", (void **) &pglDrawRangeElements},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t drawrangeelementsextfuncs[] =
|
||||
{
|
||||
{"glDrawRangeElementsEXT", (void **) &pglDrawRangeElementsEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t multitexturefuncs[] =
|
||||
{
|
||||
{"glMultiTexCoord1fARB", (void **) &pglMultiTexCoord1f},
|
||||
{"glMultiTexCoord2fARB", (void **) &pglMultiTexCoord2f},
|
||||
{"glMultiTexCoord3fARB", (void **) &pglMultiTexCoord3f},
|
||||
{"glMultiTexCoord4fARB", (void **) &pglMultiTexCoord4f},
|
||||
{"glActiveTextureARB", (void **) &pglActiveTextureARB},
|
||||
{"glClientActiveTextureARB", (void **) &pglClientActiveTexture},
|
||||
{"glClientActiveTextureARB", (void **) &pglClientActiveTextureARB},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t compiledvertexarrayfuncs[] =
|
||||
{
|
||||
{"glLockArraysEXT", (void **) &pglLockArraysEXT},
|
||||
{"glUnlockArraysEXT", (void **) &pglUnlockArraysEXT},
|
||||
{"glDrawArrays", (void **) &pglDrawArrays},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t texture3dextfuncs[] =
|
||||
{
|
||||
{"glTexImage3DEXT", (void **) &pglTexImage3D},
|
||||
{"glTexSubImage3DEXT", (void **) &pglTexSubImage3D},
|
||||
{"glCopyTexSubImage3DEXT", (void **) &pglCopyTexSubImage3D},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t atiseparatestencilfuncs[] =
|
||||
{
|
||||
{"glStencilOpSeparateATI", (void **) &pglStencilOpSeparate},
|
||||
{"glStencilFuncSeparateATI", (void **) &pglStencilFuncSeparate},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t gl2separatestencilfuncs[] =
|
||||
{
|
||||
{"glStencilOpSeparate", (void **) &pglStencilOpSeparate},
|
||||
{"glStencilFuncSeparate", (void **) &pglStencilFuncSeparate},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t stenciltwosidefuncs[] =
|
||||
{
|
||||
{"glActiveStencilFaceEXT", (void **) &pglActiveStencilFaceEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t blendequationfuncs[] =
|
||||
{
|
||||
{"glBlendEquationEXT", (void **) &pglBlendEquationEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t shaderobjectsfuncs[] =
|
||||
{
|
||||
{"glDeleteObjectARB", (void **) &pglDeleteObjectARB},
|
||||
{"glGetHandleARB", (void **) &pglGetHandleARB},
|
||||
{"glDetachObjectARB", (void **) &pglDetachObjectARB},
|
||||
{"glCreateShaderObjectARB", (void **) &pglCreateShaderObjectARB},
|
||||
{"glShaderSourceARB", (void **) &pglShaderSourceARB},
|
||||
{"glCompileShaderARB", (void **) &pglCompileShaderARB},
|
||||
{"glCreateProgramObjectARB", (void **) &pglCreateProgramObjectARB},
|
||||
{"glAttachObjectARB", (void **) &pglAttachObjectARB},
|
||||
{"glLinkProgramARB", (void **) &pglLinkProgramARB},
|
||||
{"glUseProgramObjectARB", (void **) &pglUseProgramObjectARB},
|
||||
{"glValidateProgramARB", (void **) &pglValidateProgramARB},
|
||||
{"glUniform1fARB", (void **) &pglUniform1fARB},
|
||||
{"glUniform2fARB", (void **) &pglUniform2fARB},
|
||||
{"glUniform3fARB", (void **) &pglUniform3fARB},
|
||||
{"glUniform4fARB", (void **) &pglUniform4fARB},
|
||||
{"glUniform1iARB", (void **) &pglUniform1iARB},
|
||||
{"glUniform2iARB", (void **) &pglUniform2iARB},
|
||||
{"glUniform3iARB", (void **) &pglUniform3iARB},
|
||||
{"glUniform4iARB", (void **) &pglUniform4iARB},
|
||||
{"glUniform1fvARB", (void **) &pglUniform1fvARB},
|
||||
{"glUniform2fvARB", (void **) &pglUniform2fvARB},
|
||||
{"glUniform3fvARB", (void **) &pglUniform3fvARB},
|
||||
{"glUniform4fvARB", (void **) &pglUniform4fvARB},
|
||||
{"glUniform1ivARB", (void **) &pglUniform1ivARB},
|
||||
{"glUniform2ivARB", (void **) &pglUniform2ivARB},
|
||||
{"glUniform3ivARB", (void **) &pglUniform3ivARB},
|
||||
{"glUniform4ivARB", (void **) &pglUniform4ivARB},
|
||||
{"glUniformMatrix2fvARB", (void **) &pglUniformMatrix2fvARB},
|
||||
{"glUniformMatrix3fvARB", (void **) &pglUniformMatrix3fvARB},
|
||||
{"glUniformMatrix4fvARB", (void **) &pglUniformMatrix4fvARB},
|
||||
{"glGetObjectParameterfvARB", (void **) &pglGetObjectParameterfvARB},
|
||||
{"glGetObjectParameterivARB", (void **) &pglGetObjectParameterivARB},
|
||||
{"glGetInfoLogARB", (void **) &pglGetInfoLogARB},
|
||||
{"glGetAttachedObjectsARB", (void **) &pglGetAttachedObjectsARB},
|
||||
{"glGetUniformLocationARB", (void **) &pglGetUniformLocationARB},
|
||||
{"glGetActiveUniformARB", (void **) &pglGetActiveUniformARB},
|
||||
{"glGetUniformfvARB", (void **) &pglGetUniformfvARB},
|
||||
{"glGetUniformivARB", (void **) &pglGetUniformivARB},
|
||||
{"glGetShaderSourceARB", (void **) &pglGetShaderSourceARB},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t vertexshaderfuncs[] =
|
||||
{
|
||||
{"glVertexAttribPointerARB", (void **) &pglVertexAttribPointerARB},
|
||||
{"glEnableVertexAttribArrayARB", (void **) &pglEnableVertexAttribArrayARB},
|
||||
{"glDisableVertexAttribArrayARB", (void **) &pglDisableVertexAttribArrayARB},
|
||||
{"glBindAttribLocationARB", (void **) &pglBindAttribLocationARB},
|
||||
{"glGetActiveAttribARB", (void **) &pglGetActiveAttribARB},
|
||||
{"glGetAttribLocationARB", (void **) &pglGetAttribLocationARB},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t vbofuncs[] =
|
||||
{
|
||||
{"glBindBufferARB" , (void **) &pglBindBufferARB},
|
||||
{"glDeleteBuffersARB" , (void **) &pglDeleteBuffersARB},
|
||||
{"glGenBuffersARB" , (void **) &pglGenBuffersARB},
|
||||
{"glIsBufferARB" , (void **) &pglIsBufferARB},
|
||||
{"glMapBufferARB" , (void **) &pglMapBufferARB},
|
||||
{"glUnmapBufferARB" , (void **) &pglUnmapBufferARB},
|
||||
{"glBufferDataARB" , (void **) &pglBufferDataARB},
|
||||
{"glBufferSubDataARB" , (void **) &pglBufferSubDataARB},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t texturecompressionfuncs[] =
|
||||
{
|
||||
{"glCompressedTexImage3DARB", (void **) &pglCompressedTexImage3DARB},
|
||||
{"glCompressedTexImage2DARB", (void **) &pglCompressedTexImage2DARB},
|
||||
{"glCompressedTexImage1DARB", (void **) &pglCompressedTexImage1DARB},
|
||||
{"glCompressedTexSubImage3DARB", (void **) &pglCompressedTexSubImage3DARB},
|
||||
{"glCompressedTexSubImage2DARB", (void **) &pglCompressedTexSubImage2DARB},
|
||||
{"glCompressedTexSubImage1DARB", (void **) &pglCompressedTexSubImage1DARB},
|
||||
{"glGetCompressedTexImageARB", (void **) &pglGetCompressedTexImage},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
===============
|
||||
GL_Strings_f
|
||||
|
@ -89,6 +354,7 @@ void GL_InitCommands( void )
|
|||
r_pause = Cvar_Get("paused", "0", 0, "renderer pause" );
|
||||
r_pause_bw = Cvar_Get("r_pause_effect", "0", CVAR_ARCHIVE, "allow pause effect" );
|
||||
r_physbdebug = Cvar_Get( "cm_debugdraw", "0", CVAR_ARCHIVE, "draw physics hulls" );
|
||||
r_testmode = Cvar_Get("r_test", "0", CVAR_ARCHIVE, "developer cvar, for testing new effects" );
|
||||
|
||||
r_loading = Cvar_Get("scr_loading", "0", 0, "loading bar progress" );
|
||||
r_lightlevel = Cvar_Get ("r_lightlevel", "0", 0, "no description" );
|
||||
|
@ -164,6 +430,13 @@ void GL_InitCommands( void )
|
|||
Cmd_AddCommand( "gl_strings", GL_Strings_f, "display openGL supported extensions" );
|
||||
}
|
||||
|
||||
void GL_RemoveCommands( void )
|
||||
{
|
||||
Cmd_RemoveCommand( "imagelist" );
|
||||
Cmd_RemoveCommand( "modellist" );
|
||||
Cmd_RemoveCommand( "gl_strings");
|
||||
}
|
||||
|
||||
void GL_InitBackend( void )
|
||||
{
|
||||
int i;
|
||||
|
@ -179,6 +452,13 @@ void GL_InitBackend( void )
|
|||
for( i = 0; i < 256; i++ ) r_turbsin[i] *= 0.5f;
|
||||
}
|
||||
|
||||
void GL_ShutdownBackend( void )
|
||||
{
|
||||
if( r_framebuffer ) Z_Free( r_framebuffer );
|
||||
|
||||
GL_RemoveCommands();
|
||||
}
|
||||
|
||||
void GL_SetExtension( int r_ext, int enable )
|
||||
{
|
||||
if( r_ext >= 0 && r_ext < R_EXTCOUNT )
|
||||
|
@ -246,20 +526,106 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
|
|||
|
||||
void GL_UpdateGammaRamp( void )
|
||||
{
|
||||
int i, j, v;
|
||||
int i, v;
|
||||
|
||||
Mem_Copy( gl_config.gamma_ramp, gl_config.original_ramp, sizeof(gl_config.gamma_ramp));
|
||||
|
||||
for(j = 0; j < 3; j++)
|
||||
Mem_Copy( gl_state.gammaRamp, gl_state.stateRamp, sizeof(gl_state.gammaRamp ));
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
for( i = 0; i < 256; i++)
|
||||
v = 255 * pow((float)(i + 0.5) / 255, vid_gamma->value ) + 0.5;
|
||||
v = bound( v, 0, 255 );
|
||||
gl_state.gammaRamp[i] = ((word)v)<<8;
|
||||
gl_state.gammaRamp[i+256] = ((word)v)<<8;
|
||||
gl_state.gammaRamp[i+512] = ((word)v)<<8;
|
||||
}
|
||||
SetDeviceGammaRamp( glw_state.hDC, gl_state.gammaRamp );
|
||||
}
|
||||
|
||||
void GL_InitExtensions( void )
|
||||
{
|
||||
gl_config.textureunits = 2; //FIXME
|
||||
|
||||
// initialize gl extensions
|
||||
GL_CheckExtension( "OpenGL 1.1.0", opengl_110funcs, NULL, R_OPENGL_110 );
|
||||
|
||||
// get our various GL strings
|
||||
gl_config.vendor_string = pglGetString( GL_VENDOR );
|
||||
gl_config.renderer_string = pglGetString( GL_RENDERER );
|
||||
gl_config.version_string = pglGetString( GL_VERSION );
|
||||
gl_config.extensions_string = pglGetString( GL_EXTENSIONS );
|
||||
MsgDev( D_INFO, "Video: %s\n", gl_config.renderer_string );
|
||||
|
||||
GL_CheckExtension( "WGL_EXT_swap_control", wglswapintervalfuncs, NULL, R_WGL_SWAPCONTROL );
|
||||
GL_CheckExtension( "glDrawRangeElements", drawrangeelementsfuncs, "gl_drawrangeelments", R_DRAWRANGEELMENTS );
|
||||
if(!GL_Support( R_DRAWRANGEELMENTS )) GL_CheckExtension("GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "gl_drawrangeelments", R_DRAWRANGEELMENTS );
|
||||
|
||||
// multitexture
|
||||
GL_CheckExtension("GL_ARB_multitexture", multitexturefuncs, "gl_arb_multitexture", R_ARB_MULTITEXTURE );
|
||||
if(GL_Support( R_ARB_MULTITEXTURE ))
|
||||
{
|
||||
pglGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &gl_config.textureunits );
|
||||
GL_CheckExtension( "GL_ARB_texture_env_combine", NULL, "gl_texture_env_combine", R_COMBINE_EXT );
|
||||
if(!GL_Support( R_COMBINE_EXT )) GL_CheckExtension("GL_EXT_texture_env_combine", NULL, "gl_texture_env_combine", R_COMBINE_EXT );
|
||||
if(GL_Support( R_COMBINE_EXT )) GL_CheckExtension( "GL_ARB_texture_env_dot3", NULL, "gl_texture_env_dot3", R_DOT3_ARB_EXT );
|
||||
GL_TEXTURE0 = 0;
|
||||
GL_TEXTURE1 = 1;
|
||||
}
|
||||
|
||||
gl_state.texNum = Mem_Alloc( r_temppool, sizeof(int) * gl_config.textureunits );
|
||||
gl_state.texEnv = Mem_Alloc( r_temppool, sizeof(int) * gl_config.textureunits );
|
||||
|
||||
// 3d texture support
|
||||
GL_CheckExtension( "GL_EXT_texture3D", texture3dextfuncs, "gl_texture_3d", R_TEXTURE_3D_EXT );
|
||||
if(GL_Support( R_TEXTURE_3D_EXT ))
|
||||
{
|
||||
pglGetIntegerv( GL_MAX_3D_TEXTURE_SIZE, &gl_config.max_3d_texture_size );
|
||||
if( gl_config.max_3d_texture_size < 32 )
|
||||
{
|
||||
v = 255 * pow((float)(i + 0.5) / 255, vid_gamma->value ) + 0.5;
|
||||
v = bound(v, 0, 255);
|
||||
gl_config.gamma_ramp[j][i] = (WORD)v << 8;
|
||||
GL_SetExtension( R_TEXTURE_3D_EXT, false );
|
||||
MsgDev( D_ERROR, "GL_EXT_texture3D reported bogus GL_MAX_3D_TEXTURE_SIZE, disabled\n" );
|
||||
}
|
||||
}
|
||||
SetDeviceGammaRamp(glw_state.hDC, gl_config.gamma_ramp );
|
||||
|
||||
// hardware cubemaps
|
||||
GL_CheckExtension( "GL_ARB_texture_cube_map", NULL, "gl_texture_cubemap", R_TEXTURECUBEMAP_EXT );
|
||||
if(GL_Support( R_TEXTURECUBEMAP_EXT )) pglGetIntegerv( GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, &gl_config.max_cubemap_texture_size );
|
||||
|
||||
// point particles extension
|
||||
GL_CheckExtension( "GL_EXT_point_parameters", pointparametersfunc, NULL, R_EXT_POINTPARAMETERS );
|
||||
|
||||
GL_CheckExtension( "GL_ARB_texture_non_power_of_two", NULL, "gl_texture_npot", R_ARB_TEXTURE_NPOT_EXT );
|
||||
GL_CheckExtension( "GL_ARB_texture_compression", texturecompressionfuncs, "gl_dds_hardware_support", R_TEXTURE_COMPRESSION_EXT );
|
||||
GL_CheckExtension( "GL_EXT_compiled_vertex_array", compiledvertexarrayfuncs, "gl_cva_support", R_CUSTOM_VERTEX_ARRAY_EXT );
|
||||
if(!GL_Support(R_CUSTOM_VERTEX_ARRAY_EXT)) GL_CheckExtension( "GL_SGI_compiled_vertex_array", compiledvertexarrayfuncs, "gl_cva_support", R_CUSTOM_VERTEX_ARRAY_EXT );
|
||||
GL_CheckExtension( "GL_EXT_texture_edge_clamp", NULL, "gl_clamp_to_edge", R_CLAMPTOEDGE_EXT );
|
||||
if(!GL_Support( R_CLAMPTOEDGE_EXT )) GL_CheckExtension("GL_SGIS_texture_edge_clamp", NULL, "gl_clamp_to_edge", R_CLAMPTOEDGE_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_texture_filter_anisotropic", NULL, "gl_texture_anisotropy", R_ANISOTROPY_EXT );
|
||||
if(GL_Support( R_ANISOTROPY_EXT )) pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_config.max_anisotropy );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_blend_minmax", blendequationfuncs, "gl_ext_customblend", R_BLEND_MINMAX_EXT );
|
||||
GL_CheckExtension( "GL_EXT_blend_subtract", blendequationfuncs, "gl_ext_customblend", R_BLEND_SUBTRACT_EXT );
|
||||
|
||||
GL_CheckExtension( "glStencilOpSeparate", gl2separatestencilfuncs, "gl_separate_stencil",R_SEPARATESTENCIL_EXT );
|
||||
if(!GL_Support( R_SEPARATESTENCIL_EXT )) GL_CheckExtension("GL_ATI_separate_stencil", atiseparatestencilfuncs, "gl_separate_stencil", R_SEPARATESTENCIL_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_stencil_two_side", stenciltwosidefuncs, "gl_stenciltwoside", R_STENCILTWOSIDE_EXT );
|
||||
GL_CheckExtension( "GL_ARB_vertex_buffer_object", vbofuncs, "gl_vertex_buffer_object", R_ARB_VERTEX_BUFFER_OBJECT_EXT );
|
||||
|
||||
// we don't care if it's an extension or not, they are identical functions, so keep it simple in the rendering code
|
||||
if( pglDrawRangeElements == NULL ) pglDrawRangeElements = pglDrawRangeElementsEXT;
|
||||
|
||||
// vp and fp shaders
|
||||
GL_CheckExtension( "GL_ARB_shader_objects", shaderobjectsfuncs, "gl_shaderobjects", R_SHADER_OBJECTS_EXT );
|
||||
GL_CheckExtension( "GL_ARB_shading_language_100", NULL, "gl_glslprogram", R_SHADER_GLSL100_EXT );
|
||||
GL_CheckExtension( "GL_ARB_vertex_shader", vertexshaderfuncs, "gl_vertexshader", R_VERTEX_SHADER_EXT );
|
||||
GL_CheckExtension( "GL_ARB_fragment_shader", NULL, "gl_pixelshader", R_FRAGMENT_SHADER_EXT );
|
||||
|
||||
// rectangle textures support
|
||||
if( com.strstr( gl_config.extensions_string, "GL_NV_texture_rectangle" ))
|
||||
gl_config.texRectangle = GL_TEXTURE_RECTANGLE_NV;
|
||||
else if( com.strstr( gl_config.extensions_string, "GL_EXT_texture_rectangle" ))
|
||||
gl_config.texRectangle = GL_TEXTURE_RECTANGLE_EXT;
|
||||
else gl_config.texRectangle = 0; // no rectangle
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -355,22 +721,18 @@ GL_StateTexGen
|
|||
*/
|
||||
void GL_EnableTexGen( void )
|
||||
{
|
||||
if (gl_state.texgen) return;
|
||||
pglEnable(GL_TEXTURE_GEN_S);
|
||||
pglEnable(GL_TEXTURE_GEN_T);
|
||||
pglEnable(GL_TEXTURE_GEN_R);
|
||||
pglEnable(GL_TEXTURE_GEN_Q);
|
||||
gl_state.texgen = true;
|
||||
}
|
||||
|
||||
void GL_DisableTexGen( void )
|
||||
{
|
||||
if (!gl_state.texgen) return;
|
||||
pglDisable(GL_TEXTURE_GEN_S);
|
||||
pglDisable(GL_TEXTURE_GEN_T);
|
||||
pglDisable(GL_TEXTURE_GEN_R);
|
||||
pglDisable(GL_TEXTURE_GEN_Q);
|
||||
gl_state.texgen = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -492,18 +854,14 @@ GL_SelectTexture
|
|||
*/
|
||||
void GL_SelectTexture( GLenum texture )
|
||||
{
|
||||
int tmu;
|
||||
|
||||
if(!GL_Support( R_ARB_MULTITEXTURE ))
|
||||
return;
|
||||
|
||||
if( texture == GL_TEXTURE0 )
|
||||
tmu = 0;
|
||||
else tmu = 1;
|
||||
|
||||
if( tmu == gl_state.currenttmu )
|
||||
if( gl_state.activeTMU == texture )
|
||||
return;
|
||||
gl_state.currenttmu = tmu;
|
||||
|
||||
gl_state.activeTMU = texture;
|
||||
texture = texture + GL_TEXTURE0_ARB;
|
||||
|
||||
pglActiveTextureARB( texture );
|
||||
pglClientActiveTextureARB( texture );
|
||||
|
@ -518,10 +876,10 @@ void GL_TexEnv( GLenum mode )
|
|||
{
|
||||
static int lastmodes[2] = { -1, -1 };
|
||||
|
||||
if ( mode != lastmodes[gl_state.currenttmu] )
|
||||
if( mode != lastmodes[gl_state.activeTMU] )
|
||||
{
|
||||
pglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode );
|
||||
lastmodes[gl_state.currenttmu] = mode;
|
||||
lastmodes[gl_state.activeTMU] = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -549,16 +907,18 @@ void GL_TexFilter( void )
|
|||
GL_Bind
|
||||
===============
|
||||
*/
|
||||
void GL_Bind (int texnum)
|
||||
void GL_Bind( int texnum )
|
||||
{
|
||||
extern image_t *draw_chars;
|
||||
|
||||
if (gl_nobind->value && draw_chars) // performance evaluation option
|
||||
if( !gl_state.texNum ) return;
|
||||
|
||||
if( gl_nobind->value && draw_chars ) // performance evaluation option
|
||||
texnum = draw_chars->texnum[0];
|
||||
if ( gl_state.currenttextures[gl_state.currenttmu] == texnum)
|
||||
if( gl_state.texNum[gl_state.activeTMU] == texnum)
|
||||
return;
|
||||
gl_state.currenttextures[gl_state.currenttmu] = texnum;
|
||||
pglBindTexture (GL_TEXTURE_2D, texnum);
|
||||
gl_state.texNum[gl_state.activeTMU] = texnum;
|
||||
pglBindTexture( GL_TEXTURE_2D, texnum );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -568,15 +928,17 @@ GL_Bind
|
|||
*/
|
||||
void GL_MBind( GLenum target, int texnum )
|
||||
{
|
||||
if( !gl_state.texNum ) return;
|
||||
|
||||
GL_SelectTexture( target );
|
||||
if ( target == GL_TEXTURE0 )
|
||||
{
|
||||
if ( gl_state.currenttextures[0] == texnum )
|
||||
if ( gl_state.texNum[0] == texnum )
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( gl_state.currenttextures[1] == texnum )
|
||||
if ( gl_state.texNum[1] == texnum )
|
||||
return;
|
||||
}
|
||||
GL_Bind( texnum );
|
||||
|
@ -614,7 +976,7 @@ void GL_SetDefaultState( void )
|
|||
pglEnable(GL_TEXTURE_2D);
|
||||
|
||||
pglEnable(GL_ALPHA_TEST);
|
||||
pglAlphaFunc(GL_GREATER, 0.666);
|
||||
pglAlphaFunc(GL_GREATER, 0.666f);
|
||||
|
||||
pglDisable (GL_DEPTH_TEST);
|
||||
pglDisable (GL_CULL_FACE);
|
||||
|
@ -641,7 +1003,6 @@ void GL_SetDefaultState( void )
|
|||
pglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
|
||||
gl_state.texgen = false;
|
||||
pglDisable(GL_TEXTURE_GEN_S);
|
||||
pglDisable(GL_TEXTURE_GEN_T);
|
||||
|
|
@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// draw.c
|
||||
|
||||
#include "gl_local.h"
|
||||
#include "r_font.h"
|
||||
#include "builtin.h"
|
||||
|
||||
image_t *draw_chars;
|
||||
/*
|
||||
|
@ -31,15 +31,15 @@ Draw_FindPic
|
|||
*/
|
||||
image_t *Draw_FindPic( const char *name )
|
||||
{
|
||||
string fullname;
|
||||
byte *buffer = NULL;
|
||||
size_t bufsize = 0;
|
||||
string fullname;
|
||||
const byte *buffer = NULL;
|
||||
size_t bufsize = 0;
|
||||
|
||||
//HACKHACK: use default font
|
||||
if(stristr(name, "fonts" ))
|
||||
{
|
||||
buffer = def_font;
|
||||
bufsize = sizeof(def_font);
|
||||
buffer = deffont_dds;
|
||||
bufsize = sizeof(deffont_dds);
|
||||
}
|
||||
|
||||
com.snprintf( fullname, MAX_STRING, "gfx/%s", name );
|
||||
|
@ -262,7 +262,7 @@ void Draw_FadeScreen (void)
|
|||
{
|
||||
pglEnable (GL_BLEND);
|
||||
pglDisable (GL_TEXTURE_2D);
|
||||
pglColor4f (0, 0, 0, 0.8);
|
||||
pglColor4f (0, 0, 0, 0.8f);
|
||||
pglBegin (GL_QUADS);
|
||||
|
||||
pglVertex2f (0,0);
|
||||
|
|
|
@ -21,10 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include "basetypes.h"
|
||||
#include "stdapi.h"
|
||||
#include "stdref.h"
|
||||
#include "basefiles.h"
|
||||
#include "dllapi.h"
|
||||
#include "ref_dllapi.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
#define RENDERPASS_SOLID 1
|
||||
|
@ -216,6 +213,7 @@ extern cvar_t *r_pause;
|
|||
extern cvar_t *r_width;
|
||||
extern cvar_t *r_height;
|
||||
extern cvar_t *r_mode;
|
||||
extern cvar_t *r_testmode;
|
||||
|
||||
extern cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level
|
||||
|
||||
|
@ -379,8 +377,8 @@ image_t *R_RegisterSkin (char *name);
|
|||
void R_ImageList_f (void);
|
||||
bool R_ImageHasMips( void );
|
||||
|
||||
image_t *R_LoadImage(char *name, rgbdata_t *pic, imagetype_t type );
|
||||
image_t *R_FindImage (char *name, char *buffer, int size, imagetype_t type);
|
||||
image_t *R_LoadImage( char *name, rgbdata_t *pic, imagetype_t type );
|
||||
image_t *R_FindImage( char *name, const byte *buffer, size_t size, imagetype_t type );
|
||||
|
||||
void R_InitTextures( void );
|
||||
void R_ShutdownTextures (void);
|
||||
|
@ -413,49 +411,7 @@ void GL_DrawParticles( int n, const particle_t particles[], const unsigned color
|
|||
#define GL_RENDERER_NVIDIA 0x00000004
|
||||
#define GL_RENDERER_DEFAULT 0x80000000
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int renderer;
|
||||
const char *renderer_string;
|
||||
const char *vendor_string;
|
||||
const char *version_string;
|
||||
|
||||
word original_ramp[3][256];
|
||||
word gamma_ramp[3][256];
|
||||
|
||||
// list of supported extensions
|
||||
const char *extensions_string;
|
||||
byte extension[R_EXTCOUNT];
|
||||
} glconfig_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool fullscreen;
|
||||
|
||||
int prev_mode;
|
||||
int lightmap_textures;
|
||||
float inverse_intensity;
|
||||
|
||||
int currenttextures[2];
|
||||
int currenttmu;
|
||||
|
||||
bool alpha_test;
|
||||
bool depth_test;
|
||||
bool blend;
|
||||
bool texgen;
|
||||
|
||||
int tex_rectangle_type;
|
||||
int stencil_warp;
|
||||
int stencil_two_side;
|
||||
int ati_separate_stencil;
|
||||
vec4_t draw_color; // using with Draw_* functions
|
||||
|
||||
// new stuff
|
||||
int textureunits;
|
||||
int max_3d_texture_size;
|
||||
int max_cubemap_texture_size;
|
||||
int max_anisotropy;
|
||||
} glstate_t;
|
||||
#include "r_local.h" // temporary
|
||||
|
||||
extern glconfig_t gl_config;
|
||||
extern glstate_t gl_state;
|
||||
|
@ -466,14 +422,15 @@ extern glstate_t gl_state;
|
|||
void R_EndFrame( void );
|
||||
bool R_Init_OpenGL( void );
|
||||
void R_Free_OpenGL( void );
|
||||
void R_InitExtensions( void );
|
||||
void R_CheckForErrors( void );
|
||||
|
||||
//
|
||||
// r_backend.c
|
||||
// gl_backend.c
|
||||
//
|
||||
void GL_InitBackend( void );
|
||||
bool GL_Support( int r_ext );
|
||||
void GL_InitExtensions( void );
|
||||
void GL_ShutdownBackend( void );
|
||||
void GL_SetExtension( int r_ext, int enable );
|
||||
void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cvarname, int r_ext );
|
||||
|
||||
|
@ -485,7 +442,7 @@ VERTEX ARRAYS
|
|||
====================================================================
|
||||
*/
|
||||
|
||||
#define MAX_ARRAY MAX_INPUTLINE // sorry ...
|
||||
#define MAX_ARRAY MAX_MSGLEN // sorry ...
|
||||
|
||||
#define VA_SetElem2(v, a, b) ((v)[0]=(a),(v)[1]=(b))
|
||||
#define VA_SetElem3(v, a, b, c) ((v)[0]=(a),(v)[1]=(b),(v)[2]=(c))
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
// models.c -- model loading and caching
|
||||
|
||||
#include "gl_local.h"
|
||||
#include "basefiles.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
model_t *loadmodel;
|
||||
int modfilelen;
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#ifndef R_MODEL_H
|
||||
#define R_MODEL_H
|
||||
|
||||
#include "basefiles.h"
|
||||
|
||||
/*
|
||||
|
||||
d*_t structures are on-disk representations
|
||||
|
|
|
@ -92,6 +92,7 @@ cvar_t *r_nocull;
|
|||
cvar_t *r_lerpmodels;
|
||||
cvar_t *r_lefthand;
|
||||
cvar_t *r_loading;
|
||||
cvar_t *r_testmode;
|
||||
|
||||
cvar_t *r_lightlevel; // FIXME: This is a HACK to get the client's light level
|
||||
cvar_t *r_mirroralpha;
|
||||
|
@ -538,7 +539,7 @@ void R_SetupFrame (void)
|
|||
if ( r_newrefdef.rdflags & RDF_NOWORLDMODEL )
|
||||
{
|
||||
pglEnable( GL_SCISSOR_TEST );
|
||||
pglClearColor( 0.3, 0.3, 0.3, 1 );
|
||||
pglClearColor( 0.3f, 0.3f, 0.3f, 1 );
|
||||
pglScissor( r_newrefdef.x, r_height->integer - r_newrefdef.height - r_newrefdef.y, r_newrefdef.width, r_newrefdef.height );
|
||||
pglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
pglClearColor( 1, 0, 0.5, 0.5 );
|
||||
|
@ -626,13 +627,13 @@ void R_Clear (void)
|
|||
if (trickframe & 1)
|
||||
{
|
||||
gldepthmin = 0;
|
||||
gldepthmax = 0.49999;
|
||||
gldepthmax = 0.49999f;
|
||||
pglDepthFunc (GL_LEQUAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gldepthmin = 1;
|
||||
gldepthmax = 0.5;
|
||||
gldepthmax = 0.5f;
|
||||
pglDepthFunc (GL_GEQUAL);
|
||||
}
|
||||
}
|
||||
|
@ -757,9 +758,9 @@ void R_DrawPauseScreen( void )
|
|||
r_pause->modified = false;
|
||||
}
|
||||
if(!r_pause->value) return;
|
||||
if (r_pause_alpha < 1.0f) r_pause_alpha += 0.03;
|
||||
if( r_pause_alpha < 1.0f ) r_pause_alpha += 0.03f;
|
||||
|
||||
if (r_pause_alpha <= 1.0f || r_lefthand->modified)
|
||||
if( r_pause_alpha <= 1.0f || r_lefthand->modified )
|
||||
{
|
||||
int k = r_pause_alpha * 255.0f;
|
||||
int i, s, r, g, b;
|
||||
|
@ -836,13 +837,13 @@ void R_SetGL2D( void )
|
|||
}
|
||||
else if (r_motionblur->value && (r_newrefdef.rdflags & RDF_PAIN))
|
||||
{
|
||||
if(!gl_state.tex_rectangle_type) return;
|
||||
if (blurtex)
|
||||
if( !gl_config.texRectangle ) return;
|
||||
if( blurtex )
|
||||
{
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
pglDisable(GL_TEXTURE_2D);
|
||||
|
||||
pglEnable(gl_state.tex_rectangle_type);
|
||||
pglEnable( gl_config.texRectangle );
|
||||
pglDisable (GL_ALPHA_TEST);
|
||||
pglEnable (GL_BLEND);
|
||||
pglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -861,12 +862,12 @@ void R_SetGL2D( void )
|
|||
pglVertex2f(0,r_height->integer);
|
||||
pglEnd();
|
||||
|
||||
pglDisable( gl_state.tex_rectangle_type );
|
||||
pglDisable( gl_config.texRectangle );
|
||||
pglEnable( GL_TEXTURE_2D );
|
||||
}
|
||||
if(!blurtex) pglGenTextures(1,&blurtex);
|
||||
pglBindTexture( gl_state.tex_rectangle_type, blurtex );
|
||||
pglCopyTexImage2D( gl_state.tex_rectangle_type, 0, GL_RGB, 0, 0, r_width->integer, r_height->integer, 0 );
|
||||
pglBindTexture( gl_config.texRectangle, blurtex );
|
||||
pglCopyTexImage2D( gl_config.texRectangle, 0, GL_RGB, 0, 0, r_width->integer, r_height->integer, 0 );
|
||||
pglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
pglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
@ -962,7 +963,7 @@ int R_Init( void *hinstance )
|
|||
return false;
|
||||
}
|
||||
|
||||
R_InitExtensions();
|
||||
GL_InitExtensions();
|
||||
|
||||
// vertex arrays (get rid of this)
|
||||
pglEnableClientState( GL_VERTEX_ARRAY );
|
||||
|
@ -989,15 +990,10 @@ R_Shutdown
|
|||
*/
|
||||
void R_Shutdown( void )
|
||||
{
|
||||
Cmd_RemoveCommand ("modellist");
|
||||
Cmd_RemoveCommand ("imagelist");
|
||||
Cmd_RemoveCommand ("gl_strings");
|
||||
|
||||
if( r_framebuffer ) Z_Free( r_framebuffer );
|
||||
|
||||
Mod_FreeAll ();
|
||||
R_StudioShutdown();
|
||||
R_ShutdownTextures();
|
||||
GL_ShutdownBackend();
|
||||
|
||||
// shut down OS specific OpenGL stuff like contexts, etc.
|
||||
R_Free_OpenGL();
|
||||
|
@ -1072,6 +1068,15 @@ void R_BeginFrame( void )
|
|||
R_Clear ();
|
||||
}
|
||||
|
||||
void R_EndFrame( void )
|
||||
{
|
||||
if( stricmp( gl_drawbuffer->string, "GL_BACK" ) == 0 )
|
||||
{
|
||||
if( !pwglSwapBuffers( glw_state.hDC ) )
|
||||
Host_Error("GLimp_EndFrame() - SwapBuffers() failed!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
R_SetPalette
|
||||
|
|
|
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
static vec3_t modelorg; // relative to viewpoint
|
||||
|
||||
msurface_t *r_alpha_surfaces;
|
||||
|
||||
msurface_t *r_luma_surfaces;
|
||||
#define LIGHTMAP_BYTES 4
|
||||
|
||||
#define BLOCK_WIDTH 128
|
||||
|
@ -230,42 +230,23 @@ void DrawGLPolyChain( glpoly_t *p, float soffset, float toffset )
|
|||
|
||||
void R_DrawLumaChains( void )
|
||||
{
|
||||
image_t *image;
|
||||
msurface_t *s;
|
||||
int j;
|
||||
|
||||
pglDepthMask( 0 );
|
||||
GL_EnableBlend();
|
||||
pglBlendFunc( GL_ONE, GL_ONE );
|
||||
GL_TexEnv( GL_REPLACE );
|
||||
//pglBlendFunc( GL_ONE, GL_ONE );
|
||||
GL_TexEnv( GL_MODULATE );
|
||||
|
||||
for( j = 0, image = gltextures; j < numgltextures; j++, image++ )
|
||||
for( s = r_luma_surfaces; s; s = s->texturechain )
|
||||
{
|
||||
// not registered
|
||||
if(!image->registration_sequence) continue;
|
||||
if(!image->lumatex[0]) continue;
|
||||
|
||||
// see have we got a texture chain, skip if not
|
||||
s = image->texturechain;
|
||||
if( !s )
|
||||
{
|
||||
Msg("lumatex not chain\n");
|
||||
continue;
|
||||
}
|
||||
if(!(s->texinfo->flags & SURF_LIGHT)) continue;
|
||||
|
||||
Msg("draw luma chain\n" );
|
||||
// bind the texture (once per texture rather than any of that other messing)
|
||||
GL_Bind( image->lumatex[0] );
|
||||
|
||||
for( ; s; s = s->texturechain )
|
||||
DrawGLPoly( s->polys );
|
||||
image->texturechain = NULL;
|
||||
GL_Bind(s->texinfo->image->lumatex[0]);
|
||||
DrawGLPoly (s->polys);
|
||||
}
|
||||
|
||||
pglDepthMask( 1 );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
GL_DisableBlend();
|
||||
r_luma_surfaces = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -912,7 +893,7 @@ void R_DrawBrushModel ( int passnum )
|
|||
return;
|
||||
|
||||
//currententity = e;
|
||||
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;
|
||||
gl_state.texNum[0] = gl_state.texNum[1] = -1;
|
||||
|
||||
if( !VectorIsNull( e->angles ))
|
||||
{
|
||||
|
@ -1080,6 +1061,12 @@ void R_RecursiveWorldNode (mnode_t *node)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
else if (r_testmode->integer && surf->texinfo->flags & SURF_LIGHT )
|
||||
{
|
||||
surf->texturechain = r_luma_surfaces;
|
||||
r_luma_surfaces = surf;
|
||||
continue;
|
||||
}
|
||||
else if (r_mirroralpha->value < 1.0f && !mirror_render && surf->texinfo->flags & SURF_MIRROR)
|
||||
{
|
||||
mirror = true;
|
||||
|
@ -1171,7 +1158,7 @@ void R_DrawWorld (void)
|
|||
ent.frame = (int)(r_newrefdef.time * 6.0f);
|
||||
currententity = &ent;
|
||||
|
||||
gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;
|
||||
gl_state.texNum[0] = gl_state.texNum[1] = -1;
|
||||
|
||||
pglColor3f (1,1,1);
|
||||
memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
|
||||
|
|
2994
render/r_font.h
2994
render/r_font.h
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,111 @@
|
|||
//=======================================================================
|
||||
// Copyright XashXT Group 2007 ©
|
||||
// r_local.h - render internal types
|
||||
//=======================================================================
|
||||
|
||||
#ifndef R_LOCAL_H
|
||||
#define R_LOCAL_H
|
||||
|
||||
// limits
|
||||
#define MAX_TEXTURES 4096
|
||||
#define MAX_PROGRAMS 512
|
||||
#define MAX_SHADERS 1024
|
||||
#define MAX_LIGHTMAPS 128
|
||||
#define MAX_VERTEX_BUFFERS 2048
|
||||
|
||||
typedef enum
|
||||
{
|
||||
R_OPENGL_110 = 0, // base
|
||||
R_WGL_SWAPCONTROL,
|
||||
R_COMBINE_EXT,
|
||||
R_DRAWRANGEELMENTS,
|
||||
R_ARB_MULTITEXTURE,
|
||||
R_LOCKARRAYS_EXT,
|
||||
R_TEXTURE_3D_EXT,
|
||||
R_TEXTURECUBEMAP_EXT,
|
||||
R_DOT3_ARB_EXT,
|
||||
R_CLAMPTOEDGE_EXT,
|
||||
R_ANISOTROPY_EXT,
|
||||
R_BLEND_MINMAX_EXT,
|
||||
R_STENCILTWOSIDE_EXT,
|
||||
R_BLEND_SUBTRACT_EXT,
|
||||
R_SHADER_OBJECTS_EXT,
|
||||
R_SHADER_GLSL100_EXT,
|
||||
R_VERTEX_SHADER_EXT,
|
||||
R_FRAGMENT_SHADER_EXT,
|
||||
R_EXT_POINTPARAMETERS,
|
||||
R_SEPARATESTENCIL_EXT,
|
||||
R_ARB_TEXTURE_NPOT_EXT,
|
||||
R_ARB_VERTEX_BUFFER_OBJECT_EXT,
|
||||
R_CUSTOM_VERTEX_ARRAY_EXT,
|
||||
R_TEXTURE_COMPRESSION_EXT,
|
||||
R_EXTCOUNT
|
||||
} r_opengl_extensions;
|
||||
|
||||
/*
|
||||
=======================================================================
|
||||
|
||||
GL STATE MANAGER
|
||||
|
||||
=======================================================================
|
||||
*/
|
||||
typedef struct glstate_s
|
||||
{
|
||||
bool orthogonal;
|
||||
word gammaRamp[768]; // current gamma ramp
|
||||
word stateRamp[768]; // original gamma ramp
|
||||
uint screenTexture;
|
||||
|
||||
uint activeTMU;
|
||||
int *texNum;
|
||||
int *texEnv;
|
||||
|
||||
// render current state
|
||||
bool cullFace;
|
||||
bool polygonOffsetFill;
|
||||
bool vertexProgram;
|
||||
bool fragmentProgram;
|
||||
bool alpha_test;
|
||||
bool depth_test;
|
||||
bool blend;
|
||||
|
||||
// OpenGL current state
|
||||
GLenum cullMode;
|
||||
GLfloat offsetFactor;
|
||||
GLfloat offsetUnits;
|
||||
GLenum alphaFunc;
|
||||
GLclampf alphaRef;
|
||||
GLenum blendSrc;
|
||||
GLenum blendDst;
|
||||
GLenum depthFunc;
|
||||
GLboolean depthMask;
|
||||
|
||||
|
||||
// old stuff
|
||||
vec4_t draw_color; // using with Draw_* functions
|
||||
int lightmap_textures;
|
||||
float inverse_intensity;
|
||||
} glstate_t;
|
||||
|
||||
// contains constant values that are always
|
||||
// setting by R_Init and using as read-only
|
||||
typedef struct glconfig_s
|
||||
{
|
||||
const char *renderer_string;
|
||||
const char *vendor_string;
|
||||
const char *version_string;
|
||||
|
||||
// list of supported extensions
|
||||
const char *extensions_string;
|
||||
byte extension[R_EXTCOUNT];
|
||||
|
||||
int textureunits;
|
||||
int max_3d_texture_size;
|
||||
int max_cubemap_texture_size;
|
||||
int max_anisotropy;
|
||||
GLint texRectangle;
|
||||
bool fullscreen;
|
||||
int prev_mode;
|
||||
} glconfig_t;
|
||||
|
||||
#endif//R_LOCAL_H
|
|
@ -37,10 +37,10 @@ vidmode_t vidmode[] =
|
|||
{"Mode 15: 16x9", 1366, 768, 1 },
|
||||
{"Mode 16: 16x9", 1920, 1080, 1 },
|
||||
{"Mode 17: 16x9", 2560, 1440, 1 },
|
||||
{"Mode 18: NTSC", 360, 240, 1.125 },
|
||||
{"Mode 19: NTSC", 720, 480, 1.125 },
|
||||
{"Mode 20: PAL ", 360, 283, 0.9545 },
|
||||
{"Mode 21: PAL ", 720, 566, 0.9545 },
|
||||
{"Mode 18: NTSC", 360, 240, 1.125f },
|
||||
{"Mode 19: NTSC", 720, 480, 1.125f },
|
||||
{"Mode 20: PAL ", 360, 283, 0.9545f },
|
||||
{"Mode 21: PAL ", 720, 566, 0.9545f },
|
||||
{NULL, 0, 0, 0 },
|
||||
};
|
||||
|
||||
|
@ -60,267 +60,6 @@ static dllfunc_t wgl_funcs[] =
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t wglswapintervalfuncs[] =
|
||||
{
|
||||
{"wglSwapIntervalEXT", (void **) &pwglSwapIntervalEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t opengl_110funcs[] =
|
||||
{
|
||||
{"glClearColor", (void **) &pglClearColor},
|
||||
{"glClear", (void **) &pglClear},
|
||||
{"glAlphaFunc", (void **) &pglAlphaFunc},
|
||||
{"glBlendFunc", (void **) &pglBlendFunc},
|
||||
{"glCullFace", (void **) &pglCullFace},
|
||||
{"glDrawBuffer", (void **) &pglDrawBuffer},
|
||||
{"glReadBuffer", (void **) &pglReadBuffer},
|
||||
{"glEnable", (void **) &pglEnable},
|
||||
{"glDisable", (void **) &pglDisable},
|
||||
{"glEnableClientState", (void **) &pglEnableClientState},
|
||||
{"glDisableClientState", (void **) &pglDisableClientState},
|
||||
{"glGetBooleanv", (void **) &pglGetBooleanv},
|
||||
{"glGetDoublev", (void **) &pglGetDoublev},
|
||||
{"glGetFloatv", (void **) &pglGetFloatv},
|
||||
{"glGetIntegerv", (void **) &pglGetIntegerv},
|
||||
{"glGetError", (void **) &pglGetError},
|
||||
{"glGetString", (void **) &pglGetString},
|
||||
{"glFinish", (void **) &pglFinish},
|
||||
{"glFlush", (void **) &pglFlush},
|
||||
{"glClearDepth", (void **) &pglClearDepth},
|
||||
{"glDepthFunc", (void **) &pglDepthFunc},
|
||||
{"glDepthMask", (void **) &pglDepthMask},
|
||||
{"glDepthRange", (void **) &pglDepthRange},
|
||||
{"glDrawElements", (void **) &pglDrawElements},
|
||||
{"glColorMask", (void **) &pglColorMask},
|
||||
{"glVertexPointer", (void **) &pglVertexPointer},
|
||||
{"glNormalPointer", (void **) &pglNormalPointer},
|
||||
{"glColorPointer", (void **) &pglColorPointer},
|
||||
{"glTexCoordPointer", (void **) &pglTexCoordPointer},
|
||||
{"glArrayElement", (void **) &pglArrayElement},
|
||||
{"glColor3f", (void **) &pglColor3f},
|
||||
{"glColor3fv", (void **) &pglColor3fv},
|
||||
{"glColor4f", (void **) &pglColor4f},
|
||||
{"glColor4fv", (void **) &pglColor4fv},
|
||||
{"glColor4ubv", (void **) &pglColor4ubv},
|
||||
{"glTexCoord1f", (void **) &pglTexCoord1f},
|
||||
{"glTexCoord2f", (void **) &pglTexCoord2f},
|
||||
{"glTexCoord3f", (void **) &pglTexCoord3f},
|
||||
{"glTexCoord4f", (void **) &pglTexCoord4f},
|
||||
{"glTexGenf", (void **) &pglTexGenf},
|
||||
{"glTexGenfv", (void **) &pglTexGenfv},
|
||||
{"glVertex2f", (void **) &pglVertex2f},
|
||||
{"glVertex3f", (void **) &pglVertex3f},
|
||||
{"glVertex3fv", (void **) &pglVertex3fv},
|
||||
{"glBegin", (void **) &pglBegin},
|
||||
{"glEnd", (void **) &pglEnd},
|
||||
{"glLineWidth", (void**) &pglLineWidth},
|
||||
{"glPointSize", (void**) &pglPointSize},
|
||||
{"glMatrixMode", (void **) &pglMatrixMode},
|
||||
{"glOrtho", (void **) &pglOrtho},
|
||||
{"glFrustum", (void **) &pglFrustum},
|
||||
{"glViewport", (void **) &pglViewport},
|
||||
{"glPushMatrix", (void **) &pglPushMatrix},
|
||||
{"glPopMatrix", (void **) &pglPopMatrix},
|
||||
{"glLoadIdentity", (void **) &pglLoadIdentity},
|
||||
{"glLoadMatrixd", (void **) &pglLoadMatrixd},
|
||||
{"glLoadMatrixf", (void **) &pglLoadMatrixf},
|
||||
{"glMultMatrixd", (void **) &pglMultMatrixd},
|
||||
{"glMultMatrixf", (void **) &pglMultMatrixf},
|
||||
{"glRotated", (void **) &pglRotated},
|
||||
{"glRotatef", (void **) &pglRotatef},
|
||||
{"glScaled", (void **) &pglScaled},
|
||||
{"glScalef", (void **) &pglScalef},
|
||||
{"glTranslated", (void **) &pglTranslated},
|
||||
{"glTranslatef", (void **) &pglTranslatef},
|
||||
{"glReadPixels", (void **) &pglReadPixels},
|
||||
{"glStencilFunc", (void **) &pglStencilFunc},
|
||||
{"glStencilMask", (void **) &pglStencilMask},
|
||||
{"glStencilOp", (void **) &pglStencilOp},
|
||||
{"glClearStencil", (void **) &pglClearStencil},
|
||||
{"glTexEnvf", (void **) &pglTexEnvf},
|
||||
{"glTexEnvfv", (void **) &pglTexEnvfv},
|
||||
{"glTexEnvi", (void **) &pglTexEnvi},
|
||||
{"glTexParameterf", (void **) &pglTexParameterf},
|
||||
{"glTexParameterfv", (void **) &pglTexParameterfv},
|
||||
{"glTexParameteri", (void **) &pglTexParameteri},
|
||||
{"glHint", (void **) &pglHint},
|
||||
{"glPixelStoref", (void **) &pglPixelStoref},
|
||||
{"glPixelStorei", (void **) &pglPixelStorei},
|
||||
{"glGenTextures", (void **) &pglGenTextures},
|
||||
{"glDeleteTextures", (void **) &pglDeleteTextures},
|
||||
{"glBindTexture", (void **) &pglBindTexture},
|
||||
{"glTexImage1D", (void **) &pglTexImage1D},
|
||||
{"glTexImage2D", (void **) &pglTexImage2D},
|
||||
{"glTexSubImage1D", (void **) &pglTexSubImage1D},
|
||||
{"glTexSubImage2D", (void **) &pglTexSubImage2D},
|
||||
{"glCopyTexImage1D", (void **) &pglCopyTexImage1D},
|
||||
{"glCopyTexImage2D", (void **) &pglCopyTexImage2D},
|
||||
{"glCopyTexSubImage1D", (void **) &pglCopyTexSubImage1D},
|
||||
{"glCopyTexSubImage2D", (void **) &pglCopyTexSubImage2D},
|
||||
{"glScissor", (void **) &pglScissor},
|
||||
{"glPolygonOffset", (void **) &pglPolygonOffset},
|
||||
{"glPolygonMode", (void **) &pglPolygonMode},
|
||||
{"glPolygonStipple", (void **) &pglPolygonStipple},
|
||||
{"glClipPlane", (void **) &pglClipPlane},
|
||||
{"glGetClipPlane", (void **) &pglGetClipPlane},
|
||||
{"glShadeModel", (void **) &pglShadeModel},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t pointparametersfunc[] =
|
||||
{
|
||||
{"glPointParameterfEXT", (void **) &pglPointParameterfEXT},
|
||||
{"glPointParameterfvEXT", (void **) &pglPointParameterfvEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t drawrangeelementsfuncs[] =
|
||||
{
|
||||
{"glDrawRangeElements", (void **) &pglDrawRangeElements},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t drawrangeelementsextfuncs[] =
|
||||
{
|
||||
{"glDrawRangeElementsEXT", (void **) &pglDrawRangeElementsEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t multitexturefuncs[] =
|
||||
{
|
||||
{"glMultiTexCoord1fARB", (void **) &pglMultiTexCoord1f},
|
||||
{"glMultiTexCoord2fARB", (void **) &pglMultiTexCoord2f},
|
||||
{"glMultiTexCoord3fARB", (void **) &pglMultiTexCoord3f},
|
||||
{"glMultiTexCoord4fARB", (void **) &pglMultiTexCoord4f},
|
||||
{"glActiveTextureARB", (void **) &pglActiveTextureARB},
|
||||
{"glClientActiveTextureARB", (void **) &pglClientActiveTexture},
|
||||
{"glClientActiveTextureARB", (void **) &pglClientActiveTextureARB},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t compiledvertexarrayfuncs[] =
|
||||
{
|
||||
{"glLockArraysEXT", (void **) &pglLockArraysEXT},
|
||||
{"glUnlockArraysEXT", (void **) &pglUnlockArraysEXT},
|
||||
{"glDrawArrays", (void **) &pglDrawArrays},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t texture3dextfuncs[] =
|
||||
{
|
||||
{"glTexImage3DEXT", (void **) &pglTexImage3D},
|
||||
{"glTexSubImage3DEXT", (void **) &pglTexSubImage3D},
|
||||
{"glCopyTexSubImage3DEXT", (void **) &pglCopyTexSubImage3D},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t atiseparatestencilfuncs[] =
|
||||
{
|
||||
{"glStencilOpSeparateATI", (void **) &pglStencilOpSeparate},
|
||||
{"glStencilFuncSeparateATI", (void **) &pglStencilFuncSeparate},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t gl2separatestencilfuncs[] =
|
||||
{
|
||||
{"glStencilOpSeparate", (void **) &pglStencilOpSeparate},
|
||||
{"glStencilFuncSeparate", (void **) &pglStencilFuncSeparate},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t stenciltwosidefuncs[] =
|
||||
{
|
||||
{"glActiveStencilFaceEXT", (void **) &pglActiveStencilFaceEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t blendequationfuncs[] =
|
||||
{
|
||||
{"glBlendEquationEXT", (void **) &pglBlendEquationEXT},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t shaderobjectsfuncs[] =
|
||||
{
|
||||
{"glDeleteObjectARB", (void **) &pglDeleteObjectARB},
|
||||
{"glGetHandleARB", (void **) &pglGetHandleARB},
|
||||
{"glDetachObjectARB", (void **) &pglDetachObjectARB},
|
||||
{"glCreateShaderObjectARB", (void **) &pglCreateShaderObjectARB},
|
||||
{"glShaderSourceARB", (void **) &pglShaderSourceARB},
|
||||
{"glCompileShaderARB", (void **) &pglCompileShaderARB},
|
||||
{"glCreateProgramObjectARB", (void **) &pglCreateProgramObjectARB},
|
||||
{"glAttachObjectARB", (void **) &pglAttachObjectARB},
|
||||
{"glLinkProgramARB", (void **) &pglLinkProgramARB},
|
||||
{"glUseProgramObjectARB", (void **) &pglUseProgramObjectARB},
|
||||
{"glValidateProgramARB", (void **) &pglValidateProgramARB},
|
||||
{"glUniform1fARB", (void **) &pglUniform1fARB},
|
||||
{"glUniform2fARB", (void **) &pglUniform2fARB},
|
||||
{"glUniform3fARB", (void **) &pglUniform3fARB},
|
||||
{"glUniform4fARB", (void **) &pglUniform4fARB},
|
||||
{"glUniform1iARB", (void **) &pglUniform1iARB},
|
||||
{"glUniform2iARB", (void **) &pglUniform2iARB},
|
||||
{"glUniform3iARB", (void **) &pglUniform3iARB},
|
||||
{"glUniform4iARB", (void **) &pglUniform4iARB},
|
||||
{"glUniform1fvARB", (void **) &pglUniform1fvARB},
|
||||
{"glUniform2fvARB", (void **) &pglUniform2fvARB},
|
||||
{"glUniform3fvARB", (void **) &pglUniform3fvARB},
|
||||
{"glUniform4fvARB", (void **) &pglUniform4fvARB},
|
||||
{"glUniform1ivARB", (void **) &pglUniform1ivARB},
|
||||
{"glUniform2ivARB", (void **) &pglUniform2ivARB},
|
||||
{"glUniform3ivARB", (void **) &pglUniform3ivARB},
|
||||
{"glUniform4ivARB", (void **) &pglUniform4ivARB},
|
||||
{"glUniformMatrix2fvARB", (void **) &pglUniformMatrix2fvARB},
|
||||
{"glUniformMatrix3fvARB", (void **) &pglUniformMatrix3fvARB},
|
||||
{"glUniformMatrix4fvARB", (void **) &pglUniformMatrix4fvARB},
|
||||
{"glGetObjectParameterfvARB", (void **) &pglGetObjectParameterfvARB},
|
||||
{"glGetObjectParameterivARB", (void **) &pglGetObjectParameterivARB},
|
||||
{"glGetInfoLogARB", (void **) &pglGetInfoLogARB},
|
||||
{"glGetAttachedObjectsARB", (void **) &pglGetAttachedObjectsARB},
|
||||
{"glGetUniformLocationARB", (void **) &pglGetUniformLocationARB},
|
||||
{"glGetActiveUniformARB", (void **) &pglGetActiveUniformARB},
|
||||
{"glGetUniformfvARB", (void **) &pglGetUniformfvARB},
|
||||
{"glGetUniformivARB", (void **) &pglGetUniformivARB},
|
||||
{"glGetShaderSourceARB", (void **) &pglGetShaderSourceARB},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t vertexshaderfuncs[] =
|
||||
{
|
||||
{"glVertexAttribPointerARB", (void **) &pglVertexAttribPointerARB},
|
||||
{"glEnableVertexAttribArrayARB", (void **) &pglEnableVertexAttribArrayARB},
|
||||
{"glDisableVertexAttribArrayARB", (void **) &pglDisableVertexAttribArrayARB},
|
||||
{"glBindAttribLocationARB", (void **) &pglBindAttribLocationARB},
|
||||
{"glGetActiveAttribARB", (void **) &pglGetActiveAttribARB},
|
||||
{"glGetAttribLocationARB", (void **) &pglGetAttribLocationARB},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t vbofuncs[] =
|
||||
{
|
||||
{"glBindBufferARB" , (void **) &pglBindBufferARB},
|
||||
{"glDeleteBuffersARB" , (void **) &pglDeleteBuffersARB},
|
||||
{"glGenBuffersARB" , (void **) &pglGenBuffersARB},
|
||||
{"glIsBufferARB" , (void **) &pglIsBufferARB},
|
||||
{"glMapBufferARB" , (void **) &pglMapBufferARB},
|
||||
{"glUnmapBufferARB" , (void **) &pglUnmapBufferARB},
|
||||
{"glBufferDataARB" , (void **) &pglBufferDataARB},
|
||||
{"glBufferSubDataARB" , (void **) &pglBufferSubDataARB},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static dllfunc_t texturecompressionfuncs[] =
|
||||
{
|
||||
{"glCompressedTexImage3DARB", (void **) &pglCompressedTexImage3DARB},
|
||||
{"glCompressedTexImage2DARB", (void **) &pglCompressedTexImage2DARB},
|
||||
{"glCompressedTexImage1DARB", (void **) &pglCompressedTexImage1DARB},
|
||||
{"glCompressedTexSubImage3DARB", (void **) &pglCompressedTexSubImage3DARB},
|
||||
{"glCompressedTexSubImage2DARB", (void **) &pglCompressedTexSubImage2DARB},
|
||||
{"glCompressedTexSubImage1DARB", (void **) &pglCompressedTexSubImage1DARB},
|
||||
{"glGetCompressedTexImageARB", (void **) &pglGetCompressedTexImage},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
dll_info_t opengl_dll = { "opengl32.dll", wgl_funcs, NULL, NULL, NULL, true, 0 };
|
||||
|
||||
bool R_DeleteContext( void )
|
||||
|
@ -395,8 +134,8 @@ bool R_SetPixelformat( void )
|
|||
MsgDev(D_NOTE, "GL PFD: color(%d-bits) Z(%d-bit)\n", ( int )pfd.cColorBits, ( int )pfd.cDepthBits );
|
||||
|
||||
// init gamma ramp
|
||||
ZeroMemory( gl_config.original_ramp, sizeof(gl_config.original_ramp));
|
||||
GetDeviceGammaRamp( glw_state.hDC, gl_config.original_ramp );
|
||||
ZeroMemory( gl_state.stateRamp, sizeof(gl_state.stateRamp));
|
||||
GetDeviceGammaRamp( glw_state.hDC, gl_state.stateRamp );
|
||||
vid_gamma->modified = true;
|
||||
|
||||
return true;
|
||||
|
@ -404,7 +143,7 @@ bool R_SetPixelformat( void )
|
|||
|
||||
void R_Free_OpenGL( void )
|
||||
{
|
||||
SetDeviceGammaRamp( glw_state.hDC, gl_config.original_ramp );
|
||||
SetDeviceGammaRamp( glw_state.hDC, gl_state.stateRamp );
|
||||
|
||||
if( pwglMakeCurrent ) pwglMakeCurrent( NULL, NULL );
|
||||
if( glw_state.hGLRC )
|
||||
|
@ -424,10 +163,10 @@ void R_Free_OpenGL( void )
|
|||
}
|
||||
UnregisterClass( "Xash Window", glw_state.hInst );
|
||||
|
||||
if( gl_state.fullscreen )
|
||||
if( gl_config.fullscreen )
|
||||
{
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
gl_state.fullscreen = false;
|
||||
gl_config.fullscreen = false;
|
||||
}
|
||||
Sys_FreeLibrary( &opengl_dll );
|
||||
|
||||
|
@ -546,7 +285,7 @@ rserr_t R_ChangeDisplaySettings( int vid_mode, bool fullscreen )
|
|||
|
||||
if(ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) == DISP_CHANGE_SUCCESSFUL)
|
||||
{
|
||||
gl_state.fullscreen = true;
|
||||
gl_config.fullscreen = true;
|
||||
if(!R_CreateWindow( width, height, true ))
|
||||
return rserr_invalid_mode;
|
||||
return rserr_ok;
|
||||
|
@ -566,7 +305,7 @@ rserr_t R_ChangeDisplaySettings( int vid_mode, bool fullscreen )
|
|||
if( ChangeDisplaySettings( &dm, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL )
|
||||
{
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
gl_state.fullscreen = false;
|
||||
gl_config.fullscreen = false;
|
||||
if(!R_CreateWindow( width, height, false ))
|
||||
return rserr_invalid_mode;
|
||||
return rserr_invalid_fullscreen;
|
||||
|
@ -575,7 +314,7 @@ rserr_t R_ChangeDisplaySettings( int vid_mode, bool fullscreen )
|
|||
{
|
||||
if(!R_CreateWindow( width, height, true ))
|
||||
return rserr_invalid_mode;
|
||||
gl_state.fullscreen = true;
|
||||
gl_config.fullscreen = true;
|
||||
return rserr_ok;
|
||||
}
|
||||
}
|
||||
|
@ -583,7 +322,7 @@ rserr_t R_ChangeDisplaySettings( int vid_mode, bool fullscreen )
|
|||
else
|
||||
{
|
||||
ChangeDisplaySettings( 0, 0 );
|
||||
gl_state.fullscreen = false;
|
||||
gl_config.fullscreen = false;
|
||||
if(!R_CreateWindow( width, height, false ))
|
||||
return rserr_invalid_mode;
|
||||
}
|
||||
|
@ -606,7 +345,7 @@ bool R_Init_OpenGL( void )
|
|||
|
||||
if(( err = R_ChangeDisplaySettings( r_mode->integer, fullscreen )) == rserr_ok )
|
||||
{
|
||||
gl_state.prev_mode = r_mode->integer;
|
||||
gl_config.prev_mode = r_mode->integer;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -620,12 +359,12 @@ bool R_Init_OpenGL( void )
|
|||
}
|
||||
else if( err == rserr_invalid_mode )
|
||||
{
|
||||
Cvar_SetValue( "r_mode", gl_state.prev_mode );
|
||||
Cvar_SetValue( "r_mode", gl_config.prev_mode );
|
||||
r_mode->modified = false;
|
||||
MsgDev( D_ERROR, "R_SetMode: invalid mode\n" );
|
||||
}
|
||||
// try setting it back to something safe
|
||||
if(( err = R_ChangeDisplaySettings( gl_state.prev_mode, false )) != rserr_ok )
|
||||
if(( err = R_ChangeDisplaySettings( gl_config.prev_mode, false )) != rserr_ok )
|
||||
{
|
||||
MsgDev( D_ERROR, "R_SetMode: could not revert to safe mode\n" );
|
||||
return false;
|
||||
|
@ -674,96 +413,4 @@ void R_CheckForErrors( void )
|
|||
break;
|
||||
}
|
||||
Host_Error( "R_CheckForErrors: %s", str );
|
||||
}
|
||||
|
||||
void R_EndFrame( void )
|
||||
{
|
||||
if( stricmp( gl_drawbuffer->string, "GL_BACK" ) == 0 )
|
||||
{
|
||||
if( !pwglSwapBuffers( glw_state.hDC ) )
|
||||
Host_Error("GLimp_EndFrame() - SwapBuffers() failed!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
void R_InitExtensions( void )
|
||||
{
|
||||
// initialize gl extensions
|
||||
GL_CheckExtension( "OpenGL 1.1.0", opengl_110funcs, NULL, R_OPENGL_110 );
|
||||
|
||||
// get our various GL strings
|
||||
gl_config.vendor_string = pglGetString( GL_VENDOR );
|
||||
gl_config.renderer_string = pglGetString( GL_RENDERER );
|
||||
gl_config.version_string = pglGetString( GL_VERSION );
|
||||
gl_config.extensions_string = pglGetString( GL_EXTENSIONS );
|
||||
MsgDev( D_INFO, "Video: %s\n", gl_config.renderer_string );
|
||||
|
||||
GL_CheckExtension( "WGL_EXT_swap_control", wglswapintervalfuncs, NULL, R_WGL_SWAPCONTROL );
|
||||
GL_CheckExtension( "glDrawRangeElements", drawrangeelementsfuncs, "gl_drawrangeelments", R_DRAWRANGEELMENTS );
|
||||
if(!GL_Support( R_DRAWRANGEELMENTS )) GL_CheckExtension("GL_EXT_draw_range_elements", drawrangeelementsextfuncs, "gl_drawrangeelments", R_DRAWRANGEELMENTS );
|
||||
|
||||
// multitexture
|
||||
GL_CheckExtension("GL_ARB_multitexture", multitexturefuncs, "gl_arb_multitexture", R_ARB_MULTITEXTURE );
|
||||
if(GL_Support( R_ARB_MULTITEXTURE ))
|
||||
{
|
||||
pglGetIntegerv( GL_MAX_TEXTURE_UNITS_ARB, &gl_state.textureunits );
|
||||
GL_CheckExtension( "GL_ARB_texture_env_combine", NULL, "gl_texture_env_combine", R_COMBINE_EXT );
|
||||
if(!GL_Support( R_COMBINE_EXT )) GL_CheckExtension("GL_EXT_texture_env_combine", NULL, "gl_texture_env_combine", R_COMBINE_EXT );
|
||||
if(GL_Support( R_COMBINE_EXT )) GL_CheckExtension( "GL_ARB_texture_env_dot3", NULL, "gl_texture_env_dot3", R_DOT3_ARB_EXT );
|
||||
GL_TEXTURE0 = GL_TEXTURE0_ARB;
|
||||
GL_TEXTURE1 = GL_TEXTURE1_ARB;
|
||||
}
|
||||
|
||||
// 3d texture support
|
||||
GL_CheckExtension( "GL_EXT_texture3D", texture3dextfuncs, "gl_texture_3d", R_TEXTURE_3D_EXT );
|
||||
if(GL_Support( R_TEXTURE_3D_EXT ))
|
||||
{
|
||||
pglGetIntegerv( GL_MAX_3D_TEXTURE_SIZE, &gl_state.max_3d_texture_size );
|
||||
if( gl_state.max_3d_texture_size < 32 )
|
||||
{
|
||||
GL_SetExtension( R_TEXTURE_3D_EXT, false );
|
||||
MsgDev( D_ERROR, "GL_EXT_texture3D reported bogus GL_MAX_3D_TEXTURE_SIZE, disabled\n" );
|
||||
}
|
||||
}
|
||||
|
||||
// hardware cubemaps
|
||||
GL_CheckExtension( "GL_ARB_texture_cube_map", NULL, "gl_texture_cubemap", R_TEXTURECUBEMAP_EXT );
|
||||
if(GL_Support( R_TEXTURECUBEMAP_EXT )) pglGetIntegerv( GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, &gl_state.max_cubemap_texture_size );
|
||||
|
||||
// point particles extension
|
||||
GL_CheckExtension( "GL_EXT_point_parameters", pointparametersfunc, NULL, R_EXT_POINTPARAMETERS );
|
||||
|
||||
GL_CheckExtension( "GL_ARB_texture_non_power_of_two", NULL, "gl_texture_npot", R_ARB_TEXTURE_NPOT_EXT );
|
||||
GL_CheckExtension( "GL_ARB_texture_compression", texturecompressionfuncs, "gl_dds_hardware_support", R_TEXTURE_COMPRESSION_EXT );
|
||||
GL_CheckExtension( "GL_EXT_compiled_vertex_array", compiledvertexarrayfuncs, "gl_cva_support", R_CUSTOM_VERTEX_ARRAY_EXT );
|
||||
if(!GL_Support(R_CUSTOM_VERTEX_ARRAY_EXT)) GL_CheckExtension( "GL_SGI_compiled_vertex_array", compiledvertexarrayfuncs, "gl_cva_support", R_CUSTOM_VERTEX_ARRAY_EXT );
|
||||
GL_CheckExtension( "GL_EXT_texture_edge_clamp", NULL, "gl_clamp_to_edge", R_CLAMPTOEDGE_EXT );
|
||||
if(!GL_Support( R_CLAMPTOEDGE_EXT )) GL_CheckExtension("GL_SGIS_texture_edge_clamp", NULL, "gl_clamp_to_edge", R_CLAMPTOEDGE_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_texture_filter_anisotropic", NULL, "gl_texture_anisotropy", R_ANISOTROPY_EXT );
|
||||
if(GL_Support( R_ANISOTROPY_EXT )) pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_state.max_anisotropy );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_blend_minmax", blendequationfuncs, "gl_ext_customblend", R_BLEND_MINMAX_EXT );
|
||||
GL_CheckExtension( "GL_EXT_blend_subtract", blendequationfuncs, "gl_ext_customblend", R_BLEND_SUBTRACT_EXT );
|
||||
|
||||
GL_CheckExtension( "glStencilOpSeparate", gl2separatestencilfuncs, "gl_separate_stencil",R_SEPARATESTENCIL_EXT );
|
||||
if(!GL_Support( R_SEPARATESTENCIL_EXT )) GL_CheckExtension("GL_ATI_separate_stencil", atiseparatestencilfuncs, "gl_separate_stencil", R_SEPARATESTENCIL_EXT );
|
||||
|
||||
GL_CheckExtension( "GL_EXT_stencil_two_side", stenciltwosidefuncs, "gl_stenciltwoside", R_STENCILTWOSIDE_EXT );
|
||||
GL_CheckExtension( "GL_ARB_vertex_buffer_object", vbofuncs, "gl_vertex_buffer_object", R_ARB_VERTEX_BUFFER_OBJECT_EXT );
|
||||
|
||||
// we don't care if it's an extension or not, they are identical functions, so keep it simple in the rendering code
|
||||
if( pglDrawRangeElements == NULL ) pglDrawRangeElements = pglDrawRangeElementsEXT;
|
||||
|
||||
// vp and fp shaders
|
||||
GL_CheckExtension( "GL_ARB_shader_objects", shaderobjectsfuncs, "gl_shaderobjects", R_SHADER_OBJECTS_EXT );
|
||||
GL_CheckExtension( "GL_ARB_shading_language_100", NULL, "gl_glslprogram", R_SHADER_GLSL100_EXT );
|
||||
GL_CheckExtension( "GL_ARB_vertex_shader", vertexshaderfuncs, "gl_vertexshader", R_VERTEX_SHADER_EXT );
|
||||
GL_CheckExtension( "GL_ARB_fragment_shader", NULL, "gl_pixelshader", R_FRAGMENT_SHADER_EXT );
|
||||
|
||||
// rectangle textures support
|
||||
if( com.strstr( gl_config.extensions_string, "GL_NV_texture_rectangle" ))
|
||||
gl_state.tex_rectangle_type = GL_TEXTURE_RECTANGLE_NV;
|
||||
else if( com.strstr( gl_config.extensions_string, "GL_EXT_texture_rectangle" ))
|
||||
gl_state.tex_rectangle_type = GL_TEXTURE_RECTANGLE_EXT;
|
||||
else gl_state.tex_rectangle_type = 0; // no rectangle
|
||||
}
|
|
@ -10,35 +10,6 @@
|
|||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
R_OPENGL_110 = 0, // base
|
||||
R_WGL_SWAPCONTROL,
|
||||
R_EXT_POINTPARAMETERS,
|
||||
R_COMBINE_EXT,
|
||||
R_DRAWRANGEELMENTS,
|
||||
R_ARB_MULTITEXTURE,
|
||||
R_LOCKARRAYS_EXT,
|
||||
R_TEXTURE_3D_EXT,
|
||||
R_TEXTURECUBEMAP_EXT,
|
||||
R_ARB_TEXTURE_NPOT_EXT,
|
||||
R_DOT3_ARB_EXT,
|
||||
R_CLAMPTOEDGE_EXT,
|
||||
R_ANISOTROPY_EXT,
|
||||
R_SEPARATESTENCIL_EXT,
|
||||
R_STENCILTWOSIDE_EXT,
|
||||
R_BLEND_MINMAX_EXT,
|
||||
R_BLEND_SUBTRACT_EXT,
|
||||
R_SHADER_OBJECTS_EXT,
|
||||
R_SHADER_GLSL100_EXT,
|
||||
R_VERTEX_SHADER_EXT,
|
||||
R_FRAGMENT_SHADER_EXT,
|
||||
R_ARB_VERTEX_BUFFER_OBJECT_EXT,
|
||||
R_CUSTOM_VERTEX_ARRAY_EXT,
|
||||
R_TEXTURE_COMPRESSION_EXT,
|
||||
R_EXTCOUNT
|
||||
} r_opengl_extensions;
|
||||
|
||||
typedef uint GLenum;
|
||||
typedef byte GLboolean;
|
||||
typedef uint GLbitfield;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "gl_local.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
@ -57,14 +58,7 @@ dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t **ppfra
|
|||
FS_FileBase( mod->name, name );
|
||||
com.strcat(name, va("_%s_%i%i", frame_prefix, framenum/10, framenum%10 ));
|
||||
spr_frame->size = width * height * 4; // for bounds checking
|
||||
spr_frame->buffer = (byte *)Mem_Alloc( mod->mempool, spr_frame->size );
|
||||
|
||||
if(!VFS_Unpack((byte *)(pinframe + 1), pinframe->compsize, &spr_frame->buffer, spr_frame->size ))
|
||||
{
|
||||
Image->FreeImage( spr_frame );
|
||||
MsgDev(D_WARN, "R_SpriteLoadFrame: %s probably corrupted\n", name );
|
||||
return (void *)((byte *)(pinframe + 1) + pinframe->compsize);
|
||||
}
|
||||
spr_frame->buffer = (byte *)(pinframe + 1);
|
||||
|
||||
image = R_LoadImage( name, spr_frame, it_sprite );
|
||||
if( image )
|
||||
|
@ -76,7 +70,7 @@ dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t **ppfra
|
|||
else MsgDev(D_WARN, "%s has null frame %d\n", image->name, framenum );
|
||||
|
||||
Image->FreeImage( spr_frame );
|
||||
return (dframetype_t *)((byte *)(pinframe + 1) + pinframe->compsize);
|
||||
return (dframetype_t *)((byte *)(pinframe + 1) + spr_frame->size);
|
||||
}
|
||||
|
||||
dframetype_t *R_SpriteLoadGroup (model_t *mod, void * pin, mspriteframe_t **ppframe, int framenum )
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "gl_local.h"
|
||||
#include "byteorder.h"
|
||||
#include "r_mirror.h"
|
||||
|
||||
/*
|
||||
|
@ -25,9 +26,11 @@ vec3_t m_pshadevector; //shadow vector
|
|||
|
||||
//lighting stuff
|
||||
vec3_t *m_pxformverts;
|
||||
vec3_t *m_pxformnorms;
|
||||
vec3_t *m_pvlightvalues;
|
||||
vec3_t m_blightvec [ MAXSTUDIOBONES ];
|
||||
vec3_t g_xformverts[ MAXSTUDIOVERTS ];
|
||||
vec3_t g_xformnorms[ MAXSTUDIOVERTS ];
|
||||
vec3_t g_lightvalues[MAXSTUDIOVERTS];
|
||||
|
||||
//chrome stuff
|
||||
|
@ -638,7 +641,7 @@ void R_StudioCalcRotations ( float pos[][3], vec4_t *q, mstudioseqdesc_t *pseqde
|
|||
float dadt;
|
||||
|
||||
if (f > pseqdesc->numframes - 1) f = 0; // bah, fix this bug with changing sequences too fast
|
||||
else if ( f < -0.01 ) f = -0.01;
|
||||
else if ( f < -0.01f ) f = -0.01f;
|
||||
// BUG ( somewhere else ) but this code should validate this data.
|
||||
// This could cause a crash if the frame # is negative, so we'll go ahead
|
||||
// and clamp it here
|
||||
|
@ -1294,12 +1297,16 @@ void R_StudioDrawPoints ( void )
|
|||
pstudionorms = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->normindex);
|
||||
|
||||
pskinref = (short *)((byte *)m_pTextureHeader + m_pTextureHeader->skinindex);
|
||||
if (m_skinnum != 0 && m_skinnum < m_pTextureHeader->numskinfamilies)
|
||||
if( m_skinnum != 0 && m_skinnum < m_pTextureHeader->numskinfamilies )
|
||||
pskinref += (m_skinnum * m_pTextureHeader->numskinref);
|
||||
|
||||
for (i = 0; i < m_pSubModel->numverts; i++)
|
||||
for( i = 0; i < m_pSubModel->numverts; i++ )
|
||||
{
|
||||
VectorTransform (pstudioverts[i], m_pbonestransform[pvertbone[i]], m_pxformverts[i]);
|
||||
VectorTransform( pstudioverts[i], m_pbonestransform[pvertbone[i]], m_pxformverts[i]);
|
||||
}
|
||||
for( i = 0; i < m_pSubModel->numnorms; i++ )
|
||||
{
|
||||
VectorTransform( pstudionorms[i], m_pbonestransform[pnormbone[i]], m_pxformnorms[i]);
|
||||
}
|
||||
|
||||
if (currententity->flags & RF_DEPTHHACK) // hack the depth range to prevent view model from poking into walls
|
||||
|
@ -1617,6 +1624,7 @@ void R_DrawStudioModel( int passnum )
|
|||
|
||||
m_pStudioModelCount++; // render data cache cookie
|
||||
m_pxformverts = &g_xformverts[0];
|
||||
m_pxformnorms = &g_xformnorms[0];
|
||||
m_pvlightvalues = &g_lightvalues[0];
|
||||
|
||||
if( m_pCurrentEntity->movetype == MOVETYPE_FOLLOW )
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "gl_local.h"
|
||||
#include "byteorder.h"
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
@ -1111,7 +1112,7 @@ R_FindImage
|
|||
Finds or loads the given image
|
||||
===============
|
||||
*/
|
||||
image_t *R_FindImage (char *name, char *buffer, int size, imagetype_t type)
|
||||
image_t *R_FindImage( char *name, const byte *buffer, size_t size, imagetype_t type )
|
||||
{
|
||||
image_t *image;
|
||||
rgbdata_t *pic = NULL;
|
||||
|
|
|
@ -114,6 +114,10 @@ SOURCE="$(InputPath)"
|
|||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gl_backend.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gl_draw.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -142,10 +146,6 @@ SOURCE=.\gl_warp.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_backend.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_bloom.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -182,10 +182,6 @@ SOURCE=.\r_utils.c
|
|||
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\public\const.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gl_local.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -194,10 +190,6 @@ SOURCE=.\gl_model.h
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\qmenu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\r_mirror.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "ripper.h"
|
||||
#include "qc_gen.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -6,6 +6,29 @@
|
|||
#include "ripper.h"
|
||||
#include "pal_utils.h"
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.PCX image format (ZSoft Paintbrush)
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char manufacturer;
|
||||
char version;
|
||||
char encoding;
|
||||
char bits_per_pixel;
|
||||
word xmin,ymin,xmax,ymax;
|
||||
word hres,vres;
|
||||
byte palette[48];
|
||||
char reserved;
|
||||
char color_planes;
|
||||
word bytes_per_line;
|
||||
word palette_type;
|
||||
char filler[58];
|
||||
} pcx_t;
|
||||
|
||||
bool PCX_ConvertImage( const char *name, char *buffer, int filesize )
|
||||
{
|
||||
pcx_t pcx;
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#define SPRITEHL_VERSION 2
|
||||
#define SPRITE32_VERSION 32
|
||||
|
||||
typedef enum { ST_SYNC = 0, ST_RAND } synctype_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
|
|
|
@ -6,6 +6,24 @@
|
|||
#include "ripper.h"
|
||||
#include "pal_utils.h"
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.WAL image format (Wally textures)
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
typedef struct wal_s
|
||||
{
|
||||
char name[32];
|
||||
uint width, height;
|
||||
uint offsets[4]; // four mip maps stored
|
||||
char animname[32]; // next frame in animation chain
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
} wal_t;
|
||||
|
||||
/*
|
||||
============
|
||||
ConvWAL
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef PAL_UTILS_H
|
||||
#define PAL_UTILS_H
|
||||
|
||||
#include "byteorder.h"
|
||||
|
||||
//=====================================
|
||||
// lump utils
|
||||
//=====================================
|
||||
|
|
|
@ -5,6 +5,71 @@
|
|||
#ifndef QC_GEN_H
|
||||
#define QC_GEN_H
|
||||
|
||||
#include "byteorder.h"
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.FLAT image format (Doom1/2 textures)
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
typedef struct flat_s
|
||||
{
|
||||
short width;
|
||||
short height;
|
||||
short desc[2]; // probably not used
|
||||
} flat_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.LMP image format (Quake1 gfx lumps)
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
typedef struct lmp_s
|
||||
{
|
||||
uint width;
|
||||
uint height;
|
||||
} lmp_t;
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.MIP image format (Quake1 textures)
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
typedef struct mip_s
|
||||
{
|
||||
char name[16];
|
||||
uint width, height;
|
||||
uint offsets[4]; // four mip maps stored
|
||||
} mip_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.QFONT image format (Half-Life fonts)
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short startoffset;
|
||||
short charwidth;
|
||||
} charset;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int width, height;
|
||||
int rowcount;
|
||||
int rowheight;
|
||||
charset fontinfo[256];
|
||||
byte data[4]; // variable sized
|
||||
} qfont_t;
|
||||
|
||||
// sprite types
|
||||
#define SPR_VP_PARALLEL_UPRIGHT 0
|
||||
#define SPR_FACING_UPRIGHT 1
|
||||
|
|
|
@ -7,10 +7,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include "basetypes.h"
|
||||
#include "stdapi.h"
|
||||
#include "stdref.h"
|
||||
#include "basefiles.h"
|
||||
#include "dllapi.h"
|
||||
#include "ref_dllapi.h"
|
||||
|
||||
extern stdlib_api_t com;
|
||||
extern byte *zonepool;
|
||||
|
|
10
todo.log
10
todo.log
|
@ -20,10 +20,18 @@ fopen
|
|||
4. snd encoder äëÿ roqlib
|
||||
5. doom snd extractor (write PCM header 8bit 11kHz, dump data)
|
||||
|
||||
Архитектура движка (список последних изменений)
|
||||
0. Изменить формат спрайтов на SPR32 OK
|
||||
1. Оставить для VM поддержку версии 7, 16 бит
|
||||
|
||||
Òåêóùèå çàäà÷è:
|
||||
0. Èñïðàâèòü îòðèñîâêó bbox
|
||||
1. Íîðìàëüíàÿ ëèíêîâêà OpenGL32.dll OK
|
||||
2. Убить лишние расширения
|
||||
2. Убить лишние расширения OK
|
||||
3. Навести порядок в public OK
|
||||
4. Навести порядок в basetypes.h OK
|
||||
5. Собрать все ресурсы в builtin.h
|
||||
6.
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef struct tag_dlghdr
|
|||
GUI_Form s_gui;
|
||||
wnd_options_t w_opts; //window options
|
||||
static bool viewer_init = false;
|
||||
static char textbuffer[MAX_INPUTLINE];
|
||||
static char textbuffer[MAX_MSGLEN];
|
||||
dll_info_t richedit_dll = { "riched32.dll", NULL, NULL, NULL, NULL, false, 0 };
|
||||
|
||||
|
||||
|
@ -528,7 +528,7 @@ stdout into viewer internal console
|
|||
void GUI_Print(const char *pMsg)
|
||||
{
|
||||
CHARFORMAT cf;
|
||||
char buffer[MAX_INPUTLINE*2];
|
||||
char buffer[MAX_MSGLEN*2];
|
||||
char *b = buffer;
|
||||
const char *msg;
|
||||
int bufLen;
|
||||
|
@ -543,8 +543,8 @@ void GUI_Print(const char *pMsg)
|
|||
}
|
||||
|
||||
// if the message is REALLY long, use just the last portion of it
|
||||
if ( strlen( pMsg ) > MAX_INPUTLINE - 1 )
|
||||
msg = pMsg + strlen( pMsg ) - MAX_INPUTLINE + 1;
|
||||
if ( strlen( pMsg ) > MAX_MSGLEN - 1 )
|
||||
msg = pMsg + strlen( pMsg ) - MAX_MSGLEN + 1;
|
||||
else msg = pMsg;
|
||||
|
||||
// copy into an intermediate buffer
|
||||
|
@ -611,7 +611,7 @@ void GUI_Print(const char *pMsg)
|
|||
void GUI_Error( const char *pMsg, ... )
|
||||
{
|
||||
va_list argptr;
|
||||
char text[MAX_INPUTLINE];
|
||||
char text[MAX_MSGLEN];
|
||||
|
||||
va_start (argptr, pMsg);
|
||||
vsprintf (text, pMsg, argptr);
|
||||
|
|
|
@ -12,10 +12,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "basetypes.h"
|
||||
#include "stdapi.h"
|
||||
#include "stdref.h"
|
||||
#include "basefiles.h"
|
||||
#include "dllapi.h"
|
||||
#include "ref_dllapi.h"
|
||||
|
||||
#include "mxtk.h"
|
||||
#include "options.h"
|
||||
|
@ -31,7 +28,7 @@ void FreeViewer ( void );
|
|||
|
||||
extern int com_argc;
|
||||
extern int dev_mode;
|
||||
extern char *com_argv[MAX_NUM_ARGVS];
|
||||
extern char **com_argv;
|
||||
|
||||
/*
|
||||
===========================================
|
||||
|
|
193
vprogs/client.h
193
vprogs/client.h
|
@ -1,193 +0,0 @@
|
|||
const unsigned char client_dat[] = {
|
||||
0x07, 0x00, 0x00, 0x00, 0x06, 0x1d, 0x00, 0x00, 0xf7, 0x02, 0x00,
|
||||
0x00, 0x0b, 0x00, 0x00, 0x00, 0x5e, 0x04, 0x00, 0x00, 0x82, 0x00,
|
||||
0x00, 0x00, 0x67, 0x06, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x1e,
|
||||
0x03, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00,
|
||||
0x10, 0x05, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xda, 0x00, 0x00,
|
||||
0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x2b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
|
||||
0x49, 0x44, 0x31, 0x36, 0x0d, 0x0a, 0x0d, 0x0a, 0x54, 0x68, 0x69,
|
||||
0x73, 0x20, 0x66, 0x69, 0x6c, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20,
|
||||
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x77, 0x69, 0x74,
|
||||
0x68, 0x20, 0x58, 0x61, 0x73, 0x68, 0x33, 0x44, 0x20, 0x51, 0x75,
|
||||
0x61, 0x6b, 0x65, 0x43, 0x20, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c,
|
||||
0x65, 0x72, 0x2c, 0x0a, 0x77, 0x68, 0x6f, 0x20, 0x62, 0x61, 0x73,
|
||||
0x65, 0x64, 0x20, 0x6f, 0x6e, 0x20, 0x6f, 0x72, 0x69, 0x67, 0x69,
|
||||
0x6e, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x6f, 0x66,
|
||||
0x20, 0x46, 0x6f, 0x72, 0x65, 0x54, 0x68, 0x6f, 0x75, 0x67, 0x68,
|
||||
0x74, 0x27, 0x73, 0x20, 0x51, 0x75, 0x61, 0x6b, 0x65, 0x43, 0x20,
|
||||
0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x2e, 0x0a, 0x54,
|
||||
0x68, 0x61, 0x6e, 0x6b, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x49, 0x44,
|
||||
0x20, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x61,
|
||||
0x74, 0x20, 0x61, 0x6c, 0x6c, 0x2e, 0x00, 0x0d, 0x0a, 0x0d, 0x0a,
|
||||
0x05, 0x02, 0x00, 0x00, 0x78, 0xda, 0x6d, 0x94, 0xcd, 0x8e, 0xdd,
|
||||
0x20, 0x0c, 0x85, 0xbd, 0xee, 0x53, 0xcc, 0xb6, 0x8b, 0xf6, 0x01,
|
||||
0xba, 0x1d, 0xa9, 0x52, 0x77, 0x5d, 0xb4, 0xdd, 0x22, 0x4f, 0x70,
|
||||
0x12, 0x34, 0xfc, 0x44, 0x98, 0xc9, 0x0d, 0x79, 0xfa, 0x1a, 0x42,
|
||||
0x12, 0xae, 0x34, 0x9b, 0xf8, 0x3b, 0x8e, 0x39, 0x38, 0x40, 0x00,
|
||||
0x87, 0xc6, 0xc3, 0x60, 0x0d, 0xf9, 0xf4, 0x5d, 0x63, 0x7a, 0x31,
|
||||
0xde, 0x24, 0x83, 0xd6, 0xec, 0xa4, 0x5f, 0x7e, 0x7c, 0xfb, 0xfa,
|
||||
0x05, 0x5e, 0xeb, 0xbb, 0x5f, 0x92, 0x6e, 0xf8, 0x33, 0x12, 0x35,
|
||||
0xfc, 0x1d, 0xe9, 0xcf, 0x6c, 0xfc, 0xfb, 0x29, 0x03, 0xa7, 0xa6,
|
||||
0x83, 0xe7, 0x60, 0xe9, 0x35, 0x38, 0x87, 0x5e, 0xc3, 0xdf, 0x45,
|
||||
0xac, 0xe9, 0x9f, 0xa1, 0x07, 0x2c, 0xb4, 0x42, 0x48, 0x33, 0x45,
|
||||
0x78, 0x84, 0x68, 0x35, 0x24, 0xe3, 0x08, 0xc6, 0x88, 0x8e, 0x2a,
|
||||
0x2d, 0x16, 0x33, 0x45, 0x65, 0xc3, 0x80, 0x56, 0x1c, 0xfd, 0x87,
|
||||
0x7b, 0x4a, 0x15, 0xed, 0x70, 0x3b, 0xfa, 0xe5, 0xd6, 0xf7, 0x70,
|
||||
0xcc, 0x52, 0x4d, 0x80, 0x29, 0xae, 0x14, 0x9f, 0x52, 0x0e, 0x17,
|
||||
0x5f, 0xe2, 0xaa, 0xc6, 0x10, 0x1f, 0x18, 0xf5, 0x4d, 0x6a, 0xeb,
|
||||
0x38, 0x77, 0xbc, 0x0b, 0x7f, 0x2c, 0xf5, 0x51, 0x6b, 0x24, 0xe4,
|
||||
0x23, 0x94, 0x37, 0xd1, 0x4c, 0x73, 0x3a, 0x63, 0x7d, 0x7f, 0x50,
|
||||
0xbe, 0x68, 0x07, 0x1e, 0xa2, 0x7a, 0x18, 0x9d, 0xe6, 0x4a, 0x33,
|
||||
0xd5, 0x21, 0x9b, 0x5a, 0x02, 0x43, 0xae, 0xcf, 0x14, 0x71, 0x20,
|
||||
0x85, 0xd6, 0xca, 0x4a, 0x19, 0xdd, 0x24, 0x27, 0x8c, 0xa9, 0x4f,
|
||||
0xc8, 0x27, 0x0c, 0xc9, 0x04, 0xdf, 0x24, 0x79, 0x7d, 0x8f, 0x3d,
|
||||
0x84, 0xcc, 0xff, 0x24, 0xf3, 0xb3, 0xdc, 0x9b, 0x94, 0x65, 0xf4,
|
||||
0xa4, 0x7c, 0x88, 0x0e, 0xed, 0x27, 0xa9, 0xcb, 0xe5, 0x29, 0x99,
|
||||
0x3f, 0x4b, 0x3e, 0x3b, 0x6a, 0xc3, 0xa9, 0x25, 0x66, 0x93, 0xa6,
|
||||
0x18, 0x64, 0xd9, 0x0e, 0x39, 0x04, 0x9f, 0xea, 0x36, 0x9d, 0xfd,
|
||||
0x9c, 0x75, 0xa3, 0xc5, 0x89, 0x61, 0x71, 0x61, 0x25, 0x15, 0xe2,
|
||||
0x74, 0x93, 0x34, 0x71, 0x73, 0xee, 0x78, 0x6f, 0xbc, 0x92, 0xbd,
|
||||
0xe9, 0xaa, 0x2e, 0x9c, 0x3b, 0x3e, 0xab, 0x9d, 0xf1, 0xdc, 0xe1,
|
||||
0x55, 0x5f, 0x45, 0xee, 0xc5, 0x35, 0x02, 0x37, 0xee, 0xf0, 0x1e,
|
||||
0x51, 0x44, 0xee, 0xc5, 0x0e, 0xb2, 0xbe, 0x8a, 0x33, 0xab, 0xc9,
|
||||
0x86, 0x37, 0xb4, 0x0c, 0x2e, 0x68, 0xb2, 0xc6, 0x6b, 0xda, 0x00,
|
||||
0xdf, 0x58, 0x6c, 0x5b, 0x50, 0xa7, 0x16, 0x83, 0x06, 0x7b, 0x05,
|
||||
0xdc, 0x5a, 0x50, 0x17, 0xe4, 0x13, 0x76, 0xd0, 0x11, 0x1f, 0x0e,
|
||||
0xf9, 0x1d, 0x96, 0x48, 0x85, 0xa1, 0xcc, 0x9d, 0xf2, 0x42, 0x10,
|
||||
0xe4, 0x88, 0x89, 0xfb, 0x11, 0x64, 0x6c, 0x83, 0x7c, 0xc2, 0x0e,
|
||||
0xc1, 0xea, 0xb3, 0xe8, 0xa4, 0x52, 0x77, 0x71, 0xee, 0x58, 0xce,
|
||||
0x33, 0xc9, 0xbf, 0x65, 0x52, 0xbe, 0xa0, 0x9c, 0xe8, 0x13, 0xbb,
|
||||
0xac, 0x74, 0xed, 0x27, 0x4b, 0xdc, 0x42, 0xe9, 0xfa, 0x80, 0x7c,
|
||||
0x82, 0x54, 0x5c, 0x66, 0xd8, 0xb9, 0x61, 0x67, 0x87, 0x9d, 0xdf,
|
||||
0x60, 0x91, 0xb9, 0xfe, 0x9b, 0x75, 0xf1, 0x80, 0xdf, 0xa5, 0x65,
|
||||
0x1a, 0x47, 0x1a, 0xe4, 0xd4, 0xb0, 0xdc, 0x41, 0xf5, 0x21, 0x06,
|
||||
0x35, 0xe4, 0x23, 0xec, 0xe0, 0x69, 0x4b, 0xa9, 0xde, 0x33, 0xc3,
|
||||
0x5c, 0xae, 0x2f, 0x4f, 0xa9, 0x9a, 0xa0, 0x5d, 0x66, 0x84, 0x28,
|
||||
0x1b, 0x43, 0xf1, 0x38, 0x63, 0x5c, 0xae, 0x91, 0x6b, 0xa7, 0x46,
|
||||
0x43, 0x56, 0xcb, 0x46, 0x11, 0x33, 0x4e, 0x25, 0x9d, 0xea, 0x7a,
|
||||
0xf2, 0xaa, 0xda, 0x55, 0x03, 0xf0, 0x1f, 0xb9, 0x8c, 0xe8, 0xd7,
|
||||
0x27, 0x00, 0x00, 0x00, 0x78, 0xda, 0x63, 0x60, 0x40, 0x05, 0xf2,
|
||||
0x0c, 0x97, 0x19, 0x58, 0x80, 0xb4, 0x09, 0x43, 0x37, 0x03, 0x31,
|
||||
0x40, 0x9e, 0xe1, 0x1a, 0xc3, 0x55, 0x20, 0xad, 0x0d, 0x26, 0x11,
|
||||
0x00, 0x00, 0xa6, 0xc2, 0x04, 0x80, 0x40, 0x01, 0x00, 0x00, 0x78,
|
||||
0xda, 0x8d, 0xd5, 0x4f, 0x4e, 0xc2, 0x40, 0x18, 0x87, 0xe1, 0xd6,
|
||||
0x41, 0x31, 0x1e, 0x83, 0x3d, 0x7b, 0x6e, 0xc0, 0x11, 0xbc, 0x81,
|
||||
0xd7, 0xe1, 0x8f, 0x20, 0x12, 0x2e, 0x81, 0x09, 0x2a, 0xa0, 0x88,
|
||||
0xc8, 0x46, 0x05, 0x57, 0xa2, 0x6c, 0x15, 0x44, 0x44, 0x50, 0x11,
|
||||
0x74, 0x83, 0x0a, 0x58, 0xdb, 0x26, 0x93, 0x66, 0xa6, 0xbe, 0x93,
|
||||
0x34, 0x99, 0x92, 0x87, 0xdf, 0xc7, 0x30, 0xdf, 0xb4, 0x86, 0xf1,
|
||||
0xff, 0x58, 0xfc, 0x8e, 0x80, 0xe6, 0x73, 0x77, 0x3e, 0xd7, 0x98,
|
||||
0xb9, 0x64, 0x7e, 0x40, 0xce, 0xb7, 0xc6, 0xc8, 0xe3, 0x4b, 0x63,
|
||||
0x4c, 0xe7, 0xb2, 0xc6, 0x0c, 0xe4, 0x7c, 0x82, 0x9c, 0x0f, 0x60,
|
||||
0xa6, 0xc0, 0x4c, 0x80, 0x79, 0x07, 0x66, 0x0c, 0xd6, 0xf5, 0x06,
|
||||
0x72, 0x5e, 0x35, 0x46, 0x58, 0xc6, 0xb4, 0xd5, 0x8b, 0xc6, 0xac,
|
||||
0xfc, 0x19, 0x7b, 0x3e, 0x02, 0xb5, 0x86, 0x20, 0xe7, 0x19, 0x98,
|
||||
0x81, 0x8f, 0x11, 0xc2, 0x9e, 0x3f, 0x81, 0x75, 0xf5, 0x41, 0xad,
|
||||
0x47, 0xb0, 0xae, 0x1e, 0xc8, 0x79, 0x00, 0x39, 0x5d, 0x70, 0x2e,
|
||||
0x3a, 0x20, 0xe7, 0x1e, 0x98, 0x3b, 0x50, 0xab, 0x0d, 0x7a, 0xec,
|
||||
0x16, 0xd4, 0xba, 0x01, 0xa6, 0x05, 0xfe, 0xc3, 0x2b, 0x60, 0x9a,
|
||||
0xa0, 0x56, 0x03, 0x98, 0x4b, 0x60, 0x2e, 0xc0, 0xef, 0x39, 0x07,
|
||||
0xa6, 0x0e, 0xcc, 0x19, 0x30, 0x35, 0xd0, 0xf3, 0xa7, 0x20, 0xa7,
|
||||
0x0a, 0xd6, 0x7e, 0x02, 0x4c, 0x05, 0x98, 0x63, 0x60, 0x8e, 0x80,
|
||||
0x29, 0x03, 0x53, 0x02, 0xa6, 0x08, 0xcc, 0x21, 0x30, 0x07, 0xc0,
|
||||
0xec, 0x03, 0x53, 0x00, 0xfb, 0xb5, 0xe7, 0x93, 0xe3, 0x3c, 0x0e,
|
||||
0x8d, 0x3c, 0x30, 0x39, 0x70, 0xde, 0xb3, 0xc0, 0xec, 0x02, 0x93,
|
||||
0x01, 0x66, 0x07, 0x98, 0x34, 0x30, 0x29, 0x60, 0xb6, 0x81, 0x49,
|
||||
0x02, 0x93, 0x00, 0x26, 0x0e, 0x4c, 0x4c, 0x63, 0x56, 0xed, 0xb3,
|
||||
0x6c, 0x0a, 0x67, 0xef, 0xae, 0x3d, 0x7b, 0xa9, 0xea, 0x93, 0x96,
|
||||
0x74, 0x1f, 0xd2, 0x64, 0xca, 0x26, 0xac, 0x30, 0x6b, 0x1e, 0x13,
|
||||
0x51, 0x98, 0xa0, 0xc7, 0x44, 0x15, 0x66, 0xdd, 0x31, 0x6e, 0xcf,
|
||||
0x6d, 0x2a, 0x7a, 0x7e, 0xc3, 0x7a, 0xf7, 0x48, 0xdf, 0xd9, 0x52,
|
||||
0xe4, 0x2c, 0x01, 0x16, 0x16, 0x1e, 0x96, 0x09, 0x02, 0x00, 0x00,
|
||||
0x78, 0xda, 0x2d, 0xd1, 0x4b, 0x6c, 0x4c, 0x51, 0x1c, 0xc7, 0xf1,
|
||||
0xef, 0xdc, 0xb9, 0x95, 0x48, 0x3c, 0x36, 0x16, 0xd2, 0xa0, 0xda,
|
||||
0xd2, 0xa1, 0xcc, 0x78, 0x4d, 0x5b, 0xda, 0xaa, 0x77, 0x47, 0xb5,
|
||||
0x74, 0x14, 0x53, 0x86, 0x7a, 0xb6, 0xe3, 0x6d, 0xb4, 0x0c, 0x65,
|
||||
0x68, 0x6f, 0x69, 0x9b, 0xd1, 0x85, 0x68, 0xba, 0x53, 0x12, 0x49,
|
||||
0x17, 0x82, 0xc4, 0xa6, 0xc4, 0x42, 0xa2, 0x1b, 0x6c, 0x9a, 0x2e,
|
||||
0x44, 0xb0, 0x12, 0x22, 0x95, 0x58, 0x34, 0xb1, 0xf1, 0x5a, 0x74,
|
||||
0xe1, 0x9e, 0xdf, 0xdc, 0xbb, 0xf9, 0xe4, 0x77, 0x7f, 0xb9, 0xe7,
|
||||
0x7f, 0xce, 0xb9, 0x90, 0x7d, 0x6c, 0x67, 0x0e, 0xad, 0x72, 0x2e,
|
||||
0x29, 0x39, 0x8f, 0xb4, 0xab, 0xe5, 0xe4, 0xd1, 0x25, 0xe7, 0xd3,
|
||||
0x2b, 0xf3, 0xb9, 0x23, 0x0b, 0x18, 0x92, 0x85, 0x0c, 0xcb, 0x05,
|
||||
0xbc, 0x92, 0x0b, 0x79, 0xe7, 0xea, 0x73, 0x8a, 0x18, 0x77, 0xf5,
|
||||
0x3b, 0x01, 0x26, 0xcc, 0x7b, 0x02, 0xfc, 0x91, 0x8b, 0xb0, 0x7c,
|
||||
0xc6, 0xc5, 0xcc, 0xf0, 0x99, 0xbe, 0x98, 0x5c, 0xe5, 0x62, 0xf2,
|
||||
0xe4, 0x12, 0x8a, 0xe4, 0x52, 0x82, 0xea, 0x83, 0x84, 0x95, 0x83,
|
||||
0x54, 0xca, 0x10, 0xd5, 0x72, 0x19, 0x51, 0xa3, 0xb3, 0x9c, 0xb8,
|
||||
0x5c, 0x41, 0xb3, 0x5c, 0x49, 0x52, 0xae, 0x22, 0x25, 0xc3, 0xa4,
|
||||
0x65, 0x09, 0x7d, 0xb2, 0x94, 0x41, 0xad, 0x5b, 0xc6, 0x63, 0xad,
|
||||
0x53, 0xc6, 0x0b, 0xb9, 0x9a, 0xb7, 0x72, 0x0d, 0x1f, 0xd4, 0x97,
|
||||
0x33, 0xae, 0x5c, 0xce, 0x5f, 0x59, 0xc1, 0x34, 0xcb, 0x58, 0x49,
|
||||
0xbe, 0xd1, 0x59, 0x4b, 0xa9, 0xac, 0x22, 0x22, 0xd7, 0x11, 0xb3,
|
||||
0xcc, 0xbd, 0xad, 0xa7, 0x45, 0x79, 0x03, 0x49, 0xd7, 0x29, 0xce,
|
||||
0x46, 0xdc, 0xcf, 0x5d, 0x37, 0x51, 0x20, 0x37, 0xbb, 0x27, 0x31,
|
||||
0x6e, 0x71, 0x27, 0x1a, 0xab, 0x89, 0xc8, 0x08, 0x09, 0xb9, 0x95,
|
||||
0x46, 0xdd, 0x5b, 0x0d, 0x69, 0xcd, 0xab, 0xa1, 0x47, 0x6e, 0xa3,
|
||||
0x5f, 0xd6, 0x72, 0xdf, 0x32, 0x7d, 0x1d, 0x8f, 0x94, 0xeb, 0x18,
|
||||
0x96, 0xdb, 0x19, 0x91, 0x3b, 0x18, 0x55, 0x5f, 0xcf, 0x27, 0xe5,
|
||||
0x7a, 0xbe, 0xc9, 0x28, 0x3f, 0xe5, 0x4e, 0x26, 0xd5, 0x37, 0x30,
|
||||
0xd5, 0x6f, 0x72, 0x03, 0xb3, 0xe4, 0x2e, 0xf2, 0xe5, 0x6e, 0x42,
|
||||
0xae, 0x38, 0x7b, 0xa8, 0x70, 0xcd, 0x21, 0x46, 0xad, 0x6c, 0x24,
|
||||
0xe6, 0xd9, 0x24, 0xf7, 0x92, 0x90, 0xfb, 0x48, 0xca, 0x38, 0xed,
|
||||
0x9e, 0x9d, 0x72, 0x3f, 0x19, 0x79, 0x80, 0x7e, 0xd9, 0xc4, 0x3d,
|
||||
0x8c, 0x07, 0xb9, 0xab, 0x7c, 0x88, 0x21, 0x79, 0x98, 0x27, 0xf2,
|
||||
0x08, 0xdd, 0x3e, 0xe3, 0x51, 0x9e, 0xf9, 0xb3, 0xbe, 0x94, 0xc7,
|
||||
0x78, 0x2d, 0x9b, 0x19, 0x93, 0x2d, 0x7c, 0xf4, 0xfc, 0x2a, 0x13,
|
||||
0x4c, 0xc8, 0xe3, 0xfc, 0x93, 0x27, 0xb0, 0xed, 0xac, 0xd3, 0xe5,
|
||||
0x49, 0x66, 0xcb, 0x53, 0x14, 0xca, 0xd3, 0x84, 0x3c, 0x4b, 0xe4,
|
||||
0x19, 0xaa, 0xe4, 0x59, 0x22, 0xf2, 0x1c, 0x51, 0xcf, 0xb8, 0x4c,
|
||||
0x92, 0x90, 0xe7, 0x69, 0x93, 0xad, 0x74, 0xc8, 0x36, 0x32, 0xf2,
|
||||
0x02, 0xa3, 0x3a, 0xd7, 0x45, 0x6e, 0x2b, 0xa7, 0x18, 0x90, 0x97,
|
||||
0xf8, 0x6c, 0x65, 0xfd, 0x21, 0x2f, 0xf3, 0x5b, 0xb6, 0x63, 0x69,
|
||||
0x9f, 0x57, 0x98, 0xe9, 0x99, 0x2b, 0xaf, 0x12, 0x90, 0x69, 0xc2,
|
||||
0xf2, 0x1a, 0x83, 0x76, 0xd6, 0x07, 0xf2, 0x3a, 0x0f, 0x65, 0x07,
|
||||
0x4f, 0x65, 0x27, 0xcf, 0xa5, 0xc3, 0x88, 0xec, 0xe2, 0x8d, 0xbc,
|
||||
0x41, 0x4a, 0x73, 0x6e, 0x32, 0xa6, 0xdc, 0xcd, 0x7b, 0xd9, 0xc3,
|
||||
0x17, 0xdb, 0xfc, 0xd7, 0x5e, 0xbe, 0x2b, 0x67, 0xf8, 0x25, 0x6f,
|
||||
0x31, 0x29, 0xfb, 0xb0, 0x73, 0xe0, 0x3f, 0x26, 0xa4, 0x81, 0x5a,
|
||||
0x19, 0x01, 0x00, 0x00, 0x78, 0xda, 0x25, 0xcf, 0x3b, 0x2c, 0x83,
|
||||
0x61, 0x14, 0x87, 0xf1, 0xa7, 0xed, 0x57, 0xd7, 0x56, 0x29, 0xa5,
|
||||
0xea, 0x56, 0x4a, 0xeb, 0x5a, 0x97, 0xb0, 0x5a, 0x0d, 0x16, 0x93,
|
||||
0x41, 0x62, 0xed, 0x2a, 0x91, 0x48, 0x4c, 0x2c, 0x86, 0x4e, 0x12,
|
||||
0xb1, 0x61, 0x90, 0x18, 0x0c, 0x12, 0x13, 0x93, 0xc1, 0xc2, 0x24,
|
||||
0x9d, 0x24, 0x36, 0x61, 0x34, 0x18, 0x49, 0x0c, 0x06, 0xfd, 0x1e,
|
||||
0x6f, 0xf2, 0xe5, 0x97, 0xff, 0x39, 0x6f, 0xce, 0x7b, 0x3e, 0xf8,
|
||||
0x3f, 0xd1, 0xfa, 0xb7, 0x1a, 0x83, 0x18, 0x11, 0xd6, 0x63, 0x61,
|
||||
0x8e, 0xb0, 0xa9, 0x51, 0x2a, 0x1a, 0x63, 0xcb, 0x7e, 0xc0, 0xae,
|
||||
0x39, 0x60, 0x5f, 0xe3, 0x54, 0xb5, 0x81, 0x23, 0x6d, 0xe4, 0xcc,
|
||||
0x79, 0x4d, 0x9c, 0xd4, 0x73, 0x03, 0xcd, 0x5c, 0x58, 0x6f, 0xe1,
|
||||
0x4a, 0x5b, 0x39, 0x88, 0x84, 0x73, 0x12, 0xdc, 0x98, 0x13, 0xdc,
|
||||
0x69, 0x92, 0x07, 0x6d, 0xa3, 0xe6, 0x3b, 0x29, 0x5e, 0xcc, 0x29,
|
||||
0xde, 0xb5, 0x9d, 0x4f, 0xed, 0xe0, 0xc7, 0x7e, 0x9a, 0x20, 0x08,
|
||||
0x73, 0x9a, 0xa4, 0x76, 0x92, 0xd5, 0x2e, 0x0a, 0x41, 0xd8, 0xcf,
|
||||
0x50, 0x36, 0x67, 0x58, 0xd2, 0x6e, 0x96, 0xb5, 0x87, 0x15, 0xfb,
|
||||
0x59, 0xd6, 0xcc, 0x59, 0x36, 0xb4, 0x97, 0x8a, 0xe6, 0xd8, 0xae,
|
||||
0x1b, 0xa1, 0x8f, 0x3d, 0xed, 0xa7, 0x6a, 0x7d, 0x80, 0x27, 0xff,
|
||||
0x6b, 0x90, 0x43, 0xf3, 0x10, 0xc7, 0xce, 0xc9, 0xf3, 0x1a, 0x0d,
|
||||
0x73, 0x9e, 0x0f, 0x1d, 0xe6, 0x5b, 0x47, 0x88, 0xba, 0x67, 0x81,
|
||||
0x94, 0x7b, 0x17, 0xc8, 0xe9, 0x28, 0x25, 0x1d, 0x63, 0xd1, 0x7e,
|
||||
0x91, 0x53, 0xe7, 0x15, 0x39, 0xd7, 0x12, 0x97, 0x3a, 0xce, 0xb5,
|
||||
0x4e, 0x70, 0x5b, 0x37, 0x60, 0x92, 0x7b, 0xf7, 0x99, 0xe2, 0xd1,
|
||||
0xfa, 0x34, 0x3b, 0xbe, 0x33, 0x43, 0xcd, 0x5c, 0xe6, 0x59, 0x67,
|
||||
0x79, 0xf3, 0xde, 0x1c, 0x5f, 0xe6, 0x79, 0x7e, 0x75, 0x81, 0x20,
|
||||
0x0e, 0x7f, 0x2f, 0x5b, 0x27, 0x31, 0xab, 0x00, 0x00, 0x00, 0x78,
|
||||
0xda, 0xed, 0xd0, 0xc7, 0x4e, 0x42, 0x51, 0x14, 0x05, 0xd0, 0x27,
|
||||
0x58, 0x50, 0x10, 0xec, 0x20, 0x48, 0xb1, 0xf7, 0x0e, 0x88, 0x4a,
|
||||
0x79, 0x20, 0x52, 0xf4, 0xa7, 0xf8, 0x74, 0x97, 0x86, 0x01, 0x13,
|
||||
0x46, 0x8c, 0x4c, 0xd8, 0x39, 0xeb, 0x26, 0x37, 0x39, 0xb9, 0xc9,
|
||||
0xbe, 0x41, 0x30, 0xcf, 0x6f, 0x3e, 0xe9, 0xd1, 0x67, 0xc0, 0x90,
|
||||
0x6f, 0xbe, 0x66, 0x78, 0x73, 0x81, 0x08, 0x51, 0x16, 0x59, 0x62,
|
||||
0x99, 0x15, 0x62, 0xac, 0xb2, 0x46, 0x9c, 0x04, 0xeb, 0x24, 0x49,
|
||||
0xb1, 0xc1, 0x26, 0x5b, 0x6c, 0xb3, 0xc3, 0x2e, 0x7b, 0xa4, 0xc9,
|
||||
0xb0, 0x4f, 0x96, 0x1c, 0x07, 0xe4, 0x29, 0x50, 0xa4, 0xc4, 0x21,
|
||||
0x47, 0x1c, 0x73, 0xc2, 0x29, 0x67, 0x9c, 0x73, 0xc1, 0x25, 0x57,
|
||||
0x5c, 0x73, 0xc3, 0x2d, 0x77, 0xdc, 0x4f, 0x74, 0x78, 0xe0, 0x91,
|
||||
0xa7, 0x7f, 0xde, 0x67, 0xb2, 0xc7, 0x33, 0x65, 0x2a, 0x54, 0x79,
|
||||
0xa1, 0xf6, 0xd7, 0x76, 0xd4, 0x72, 0x84, 0x86, 0x51, 0xf8, 0xea,
|
||||
0xf2, 0xc6, 0x3b, 0x75, 0x1a, 0x34, 0x19, 0x2f, 0x05, 0x6d, 0x3a,
|
||||
0x7c, 0xd0, 0x1d, 0xff, 0xc5, 0xb4, 0xfc, 0x00, 0xb3, 0x36, 0x12,
|
||||
0x63
|
||||
};
|
|
@ -1171,7 +1171,7 @@ bool PR_Decompile( const char *name )
|
|||
if( vm.prog->sources ) // source always are packed
|
||||
{
|
||||
int i, numsources = LittleLong(*(int*)vm.prog->sources);
|
||||
includeddatafile_t *src = (includeddatafile_t *)(((int *)vm.prog->sources)+1);
|
||||
dsource_t *src = (dsource_t *)(((int *)vm.prog->sources)+1);
|
||||
char *in, *file;
|
||||
|
||||
for( i = 0; i < numsources; i++, src++ )
|
||||
|
|
|
@ -360,7 +360,7 @@ Returns a string describing *data in a type specific manner
|
|||
*/
|
||||
char *PRVM_ValueString( etype_t type, prvm_eval_t *val )
|
||||
{
|
||||
static char line[MAX_INPUTLINE];
|
||||
static char line[MAX_MSGLEN];
|
||||
ddef_t *def;
|
||||
mfunction_t *f;
|
||||
int n;
|
||||
|
@ -426,7 +426,7 @@ Easier to parse than PR_ValueString
|
|||
*/
|
||||
char *PRVM_UglyValueString (etype_t type, prvm_eval_t *val)
|
||||
{
|
||||
static char line[MAX_INPUTLINE];
|
||||
static char line[MAX_MSGLEN];
|
||||
int i;
|
||||
const char *s;
|
||||
ddef_t *def;
|
||||
|
@ -558,7 +558,7 @@ void PRVM_ED_Print(edict_t *ed)
|
|||
int i, j;
|
||||
const char *name;
|
||||
int type;
|
||||
char tempstring[MAX_INPUTLINE], tempstring2[260]; // temporary string buffers
|
||||
char tempstring[MAX_MSGLEN], tempstring2[260]; // temporary string buffers
|
||||
|
||||
if (ed->priv.ed->free)
|
||||
{
|
||||
|
@ -817,7 +817,7 @@ PRVM_ED_ParseGlobals
|
|||
*/
|
||||
void PRVM_ED_ParseGlobals (const char *data)
|
||||
{
|
||||
char keyname[MAX_INPUTLINE];
|
||||
char keyname[MAX_MSGLEN];
|
||||
ddef_t *key;
|
||||
|
||||
while (1)
|
||||
|
@ -910,7 +910,7 @@ bool PRVM_ED_ParseEpair(edict_t *ent, ddef_t *key, const char *s)
|
|||
s++;
|
||||
i = com.atoi(s);
|
||||
if (i >= vm.prog->limit_edicts)
|
||||
MsgDev(D_WARN, "PRVM_ED_ParseEpair: ev_entity reference too large (edict %u >= MAX_EDICTS %u) on %s\n", (uint)i, (uint)MAX_EDICTS, PRVM_NAME);
|
||||
MsgDev(D_WARN, "PRVM_ED_ParseEpair: ev_entity reference too large (edict %u >= limit_edicts %u) on %s\n", (uint)i, (uint)vm.prog->limit_edicts, PRVM_NAME);
|
||||
while (i >= vm.prog->max_edicts)
|
||||
PRVM_MEM_IncreaseEdicts();
|
||||
// if IncreaseEdicts was called the base pointer needs to be updated
|
||||
|
@ -1307,7 +1307,7 @@ void PRVM_LoadProgs( const char *filename, int numedfunc, char **ed_func, int nu
|
|||
{
|
||||
// debug info
|
||||
if( vm.prog->progs->ofsfiles )
|
||||
vm.prog->sources = (includeddatafile_t*)((byte *)vm.prog->progs + vm.prog->progs->ofsfiles);
|
||||
vm.prog->sources = (dsource_t*)((byte *)vm.prog->progs + vm.prog->progs->ofsfiles);
|
||||
if( vm.prog->progs->ofslinenums )
|
||||
vm.prog->linenums = (int *)((byte *)vm.prog->progs + vm.prog->progs->ofslinenums);
|
||||
if( vm.prog->progs->ofs_types )
|
||||
|
@ -1418,8 +1418,8 @@ void PRVM_LoadProgs( const char *filename, int numedfunc, char **ed_func, int nu
|
|||
|
||||
if( vm.prog->sources ) // source always are packed
|
||||
{
|
||||
int numsources = LittleLong(*(int*)vm.prog->sources);
|
||||
includeddatafile_t *src = (includeddatafile_t *)(((int *)vm.prog->sources)+1);
|
||||
int numsources = LittleLong(*(int*)vm.prog->sources);
|
||||
dsource_t *src = (dsource_t *)(((int *)vm.prog->sources)+1);
|
||||
}
|
||||
|
||||
if( vm.prog->linenums && vm.prog->progs->blockscompressed & COMP_LINENUMS )
|
||||
|
@ -1698,7 +1698,7 @@ void PRVM_Fields_f (void)
|
|||
{
|
||||
int i, j, ednum, used, usedamount;
|
||||
int *counts;
|
||||
char tempstring[MAX_INPUTLINE], tempstring2[260];
|
||||
char tempstring[MAX_MSGLEN], tempstring2[260];
|
||||
const char *name;
|
||||
edict_t *ed;
|
||||
ddef_t *d;
|
||||
|
@ -1899,7 +1899,7 @@ void PRVM_GlobalSet_f(void)
|
|||
void VM_Warning(const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char msg[MAX_INPUTLINE];
|
||||
char msg[MAX_MSGLEN];
|
||||
|
||||
va_start(argptr, fmt);
|
||||
com.sprintf(msg, fmt, argptr);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define PR_LOCAL_H
|
||||
|
||||
#include <setjmp.h>
|
||||
#include "byteorder.h"
|
||||
|
||||
/*
|
||||
|
||||
|
@ -24,7 +25,7 @@ TODO:
|
|||
#define MAX_NAME 64 // chars long
|
||||
#define MAX_PARMS 8
|
||||
#define MAX_PARMS_EXTRA 128
|
||||
#define PROGDEFS_MAX_SIZE MAX_INPUTLINE // 16 kbytes
|
||||
#define PROGDEFS_MAX_SIZE MAX_MSGLEN // 32 kbytes
|
||||
|
||||
#define CMPW_COPY 0
|
||||
#define CMPW_ENCRYPT 1
|
||||
|
@ -99,7 +100,8 @@ typedef enum
|
|||
tt_immediate, // string, float, vector
|
||||
} token_type_t;
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
// progs 6 keywords
|
||||
KEYWORD_DO,
|
||||
KEYWORD_IF,
|
||||
|
@ -145,6 +147,23 @@ enum {
|
|||
NUM_KEYWORDS
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ev_void,
|
||||
ev_string,
|
||||
ev_float,
|
||||
ev_vector,
|
||||
ev_entity,
|
||||
ev_field,
|
||||
ev_function,
|
||||
ev_pointer,
|
||||
ev_integer,
|
||||
ev_variant,
|
||||
ev_struct,
|
||||
ev_union,
|
||||
ev_bool,
|
||||
} etype_t;
|
||||
|
||||
typedef struct bucket_s
|
||||
{
|
||||
void *data;
|
||||
|
@ -181,6 +200,21 @@ struct function_s
|
|||
uint parm_ofs[MAX_PARMS];// always contiguous, right?
|
||||
};
|
||||
|
||||
typedef struct type_s
|
||||
{
|
||||
etype_t type;
|
||||
|
||||
struct type_s *parentclass; // type_entity...
|
||||
struct type_s *next;
|
||||
struct type_s *aux_type; // return type or field type
|
||||
struct type_s *param;
|
||||
|
||||
int num_parms; // -1 = variable args
|
||||
uint ofs; // inside a structure.
|
||||
uint size;
|
||||
char *name;
|
||||
} type_t;
|
||||
|
||||
typedef struct temp_s
|
||||
{
|
||||
gofs_t ofs;
|
||||
|
@ -193,13 +227,24 @@ typedef struct temp_s
|
|||
|
||||
typedef union eval_s
|
||||
{
|
||||
float _float;
|
||||
int _int;
|
||||
float vector[3];
|
||||
func_t function;
|
||||
string_t string;
|
||||
union eval_s *ptr;
|
||||
} eval_t;
|
||||
|
||||
// virtual typedef
|
||||
typedef union prvm_eval_s
|
||||
{
|
||||
int edict;
|
||||
int _int;
|
||||
float _float;
|
||||
float vector[3];
|
||||
func_t function;
|
||||
int _int;
|
||||
union eval_s *ptr;
|
||||
} eval_t;
|
||||
string_t string;
|
||||
} prvm_eval_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
//=======================================================================
|
||||
|
||||
#include "vprogs.h"
|
||||
|
||||
#include "server.h"
|
||||
#include "client.h"
|
||||
#include "uimenu.h"
|
||||
#include "builtin.h"
|
||||
|
||||
stdlib_api_t com;
|
||||
byte *qccpool;
|
||||
|
|
|
@ -280,7 +280,7 @@ if it needs
|
|||
*/
|
||||
int PR_WriteSourceFiles(file_t *h, dprograms_t *progs, bool sourceaswell)
|
||||
{
|
||||
includeddatafile_t *idf;
|
||||
dsource_t *idf;
|
||||
cachedsourcefile_t *f;
|
||||
int num = 0;
|
||||
int ofs;
|
||||
|
@ -293,7 +293,7 @@ int PR_WriteSourceFiles(file_t *h, dprograms_t *progs, bool sourceaswell)
|
|||
}
|
||||
if (!num) return 0;
|
||||
|
||||
idf = Qalloc(sizeof(includeddatafile_t) * num);
|
||||
idf = Qalloc(sizeof(dsource_t) * num);
|
||||
for( f = sourcefile, num = 0; f; f = f->next )
|
||||
{
|
||||
if( f->type == FT_CODE && !sourceaswell )
|
||||
|
@ -307,7 +307,7 @@ int PR_WriteSourceFiles(file_t *h, dprograms_t *progs, bool sourceaswell)
|
|||
}
|
||||
ofs = FS_Tell(h);
|
||||
FS_Write( h, &num, sizeof(int));
|
||||
FS_Write( h, idf, sizeof(includeddatafile_t) * num );
|
||||
FS_Write( h, idf, sizeof(dsource_t) * num );
|
||||
sourcefile = NULL;
|
||||
|
||||
return ofs;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue