1
0
Fork 0
forked from fte/fteqw

Updated QVM apiFixed up some of the slowness in the sky/water warping code.

Enabled freetype in gl builds. It'll try to link dynamically. Headers are included for windows users. unix users will need the freetype2-dev package for their system, sorry. you could probably get away with editing the makefile to include the headers if that's a problem.
Fixed occasional missing skies.
Updated q1qvm api stuff version (to 13).
Cleaned up the ban code. There are no longer two separate mechanisms to ban people.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3279 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2009-07-14 23:42:54 +00:00
parent 33bdcfb367
commit 57c9515b39
39 changed files with 10425 additions and 384 deletions

View file

@ -355,6 +355,7 @@ GLQUAKE_OBJS = \
gl_rlight.o \
gl_rmain.o \
gl_rmisc.o \
gl_font.o \
gl_heightmap.o \
gl_rsurf.o \
ltface.o \

View file

@ -396,8 +396,8 @@ presetinfo_t preset[] =
{"gl_bump", {"0", "0", "0", "1", "1"}},
{"gl_specular", {"0", "0", "0", "1", "1"}},
{"r_loadlit", {"0", "1", "1", "2", "2"}},
{"r_fastsky", {"1", "0", "0", "0", "0"}},
{"r_waterlayers", {"0", "2", "3", "4", "4"}},
{"r_fastsky", {"1", "0", "0", "-1", "-1"}},
{"r_waterlayers", {"0", "2", "", "4", "4"}},
{"r_shadows", {"0", "0", "0", "1", "1"}},
{"r_shadow_realtime_world",{"0", "0", "0", "0", "1"}},
{"gl_detail", {"0", "0", "0", "1", "1"}},

View file

@ -85,7 +85,12 @@ void R_ParticleSystem_Callback(struct cvar_s *var, char *oldvalue)
cvar_t r_rockettrail = SCVARFC("r_rockettrail", "1", CVAR_SEMICHEAT, R_Rockettrail_Callback);
cvar_t r_grenadetrail = SCVARFC("r_grenadetrail", "1", CVAR_SEMICHEAT, R_Grenadetrail_Callback);
#ifdef MINIMAL
//minimal builds get a different default.
cvar_t r_particlesystem = SCVARFC("r_particlesystem", "classic", CVAR_SEMICHEAT, R_ParticleSystem_Callback);
#else
cvar_t r_particlesystem = SCVARFC("r_particlesystem", "script", CVAR_SEMICHEAT, R_ParticleSystem_Callback);
#endif
cvar_t r_particlesdesc = SCVARF("r_particlesdesc", "spikeset tsshaft", CVAR_SEMICHEAT);
extern cvar_t r_bouncysparks;
extern cvar_t r_part_rain;

View file

@ -83,8 +83,13 @@ cvar_t r_drawflat = SCVARF ("r_drawflat", "0",
cvar_t r_drawflat_nonworldmodel = SCVAR ("r_drawflat_nonworldmodel", "0");
cvar_t r_drawviewmodel = SCVAR ("r_drawviewmodel", "1");
cvar_t r_drawviewmodelinvis = SCVAR ("r_drawviewmodelinvis", "0");
#ifdef MINIMAL
cvar_t r_dynamic = SCVARF ("r_dynamic", "0",
CVAR_ARCHIVE);
#else
cvar_t r_dynamic = SCVARF ("r_dynamic", "1",
CVAR_ARCHIVE);
#endif
cvar_t r_fastsky = SCVAR ("r_fastsky", "0");
cvar_t r_fastskycolour = SCVARF ("r_fastskycolour", "0",
CVAR_RENDERERCALLBACK);
@ -102,8 +107,13 @@ cvar_t r_floortexture = SCVARF ("r_floortexture", "",
CVAR_RENDERERCALLBACK);
cvar_t r_fullbright = SCVARF ("r_fullbright", "0",
CVAR_CHEAT);
#ifdef MINIMAL
cvar_t r_fullbrightSkins = SCVARF ("r_fullbrightSkins", "1",
CVAR_SEMICHEAT);
#else
cvar_t r_fullbrightSkins = SCVARF ("r_fullbrightSkins", "0",
CVAR_SEMICHEAT);
#endif
cvar_t r_lightmap_saturation = SCVAR ("r_lightmap_saturation", "1");
cvar_t r_lightstylesmooth = SCVAR ("r_lightstylesmooth", "0");
cvar_t r_lightstylespeed = SCVAR ("r_lightstylespeed", "10");
@ -313,7 +323,7 @@ cvar_t gl_picmip2d = SCVAR ("gl_picmip2d", "0");
cvar_t gl_nohwblend = SCVAR ("gl_nohwblend","1");
cvar_t gl_savecompressedtex = SCVAR ("gl_savecompressedtex", "0");
cvar_t gl_schematics = SCVAR ("gl_schematics", "0");
cvar_t gl_skyboxdist = SCVAR ("gl_skyboxdist", "2300");
cvar_t gl_skyboxdist = SCVAR ("gl_skyboxdist", "0"); //0 = guess.
cvar_t gl_smoothcrosshair = SCVAR ("gl_smoothcrosshair", "1");
//gl blends. Set this to 1 to stop the outside of your conchars from being visible

View file

@ -67,6 +67,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AVAIL_D3D
#endif
#ifdef _WIN32
//needs testing on other platforms
#define AVAIL_FREETYPE
#endif
#ifdef NO_PNG
#undef AVAIL_PNGLIB
#endif
@ -82,6 +87,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if defined(NO_MASM) || !defined(_WIN32)
#undef AVAIL_MASM
#endif
#if defined(NO_FREETYPE)
#undef AVAIL_FREETYPE
#endif
//#define AVAIL_FREETYPE
//#define NEWBACKEND
@ -232,6 +240,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef VM_Q1
#endif
#if defined(SWQUAKE) || defined(GLQUAKE)
//not supported in anything but GL. avoid bugs.
#undef AVAIL_FREETYPE
#endif
//remove any options that depend upon GL.
#ifndef SERVERONLY
#if defined(SWQUAKE) && !defined(GLQUAKE)

View file

@ -63,7 +63,7 @@ struct vm_s {
void *hInst;
// native
int (EXPORT_FN *vmMain)(int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
qintptr_t (EXPORT_FN *vmMain)(qintptr_t command, qintptr_t arg0, qintptr_t arg1, qintptr_t arg2, qintptr_t arg3, qintptr_t arg4, qintptr_t arg5, qintptr_t arg6);
};
#if defined(__MORPHOS__) && I_AM_BIGFOOT
@ -91,7 +91,6 @@ dllhandle_t *QVM_LoadDLL(const char *name, void **vmMain, int (EXPORT_FN *syscal
#ifdef _WIN32
sprintf(dllname, "%sx86.dll", name);
#elif defined(__amd64__)
return 0; //give up early, don't even try going there
sprintf(dllname, "%samd.so", name);
#elif defined(_M_IX86) || defined(__i386__)
sprintf(dllname, "%sx86.so", name);
@ -105,7 +104,7 @@ dllhandle_t *QVM_LoadDLL(const char *name, void **vmMain, int (EXPORT_FN *syscal
hVM=NULL;
{
char name[MAX_OSPATH];
char fname[MAX_OSPATH];
char *gpath;
// run through the search paths
gpath = NULL;
@ -114,10 +113,20 @@ dllhandle_t *QVM_LoadDLL(const char *name, void **vmMain, int (EXPORT_FN *syscal
gpath = COM_NextPath (gpath);
if (!gpath)
return NULL; // couldn't find one anywhere
snprintf (name, sizeof(name), "%s/%s", gpath, dllname);
Con_DPrintf("Loading native: %s\n", name);
hVM = Sys_LoadLibrary(name, funcs);
snprintf (fname, sizeof(fname), "%s/%s", gpath, dllname);
Con_DPrintf("Loading native: %s\n", fname);
hVM = Sys_LoadLibrary(fname, funcs);
if (hVM)
{
break;
}
snprintf (fname, sizeof(fname), "%s/%s", gpath, name);
Con_DPrintf("Loading native: %s\n", fname);
hVM = Sys_LoadLibrary(fname, funcs);
if (hVM)
{
break;
@ -1046,25 +1055,39 @@ void *VM_MemoryBase(vm_t *vm)
}
}
/*returns true if we're running a 32bit vm on a 64bit host (in case we need workarounds)*/
qboolean VM_NonNative(vm_t *vm)
{
switch(vm->type)
{
case VM_BYTECODE:
return sizeof(int) != sizeof(void*);
case VM_NATIVE:
return false;
default:
return false;
}
}
/*
** VM_Call
*/
int VARGS VM_Call(vm_t *vm, int instruction, ...)
qintptr_t VARGS VM_Call(vm_t *vm, qintptr_t instruction, ...)
{
va_list argptr;
int arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
qintptr_t arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
if(!vm) Sys_Error("VM_Call with NULL vm");
va_start(argptr, instruction);
arg0=va_arg(argptr, int);
arg1=va_arg(argptr, int);
arg2=va_arg(argptr, int);
arg3=va_arg(argptr, int);
arg4=va_arg(argptr, int);
arg5=va_arg(argptr, int);
arg6=va_arg(argptr, int);
arg7=va_arg(argptr, int);
arg0=va_arg(argptr, qintptr_t);
arg1=va_arg(argptr, qintptr_t);
arg2=va_arg(argptr, qintptr_t);
arg3=va_arg(argptr, qintptr_t);
arg4=va_arg(argptr, qintptr_t);
arg5=va_arg(argptr, qintptr_t);
arg6=va_arg(argptr, qintptr_t);
arg7=va_arg(argptr, qintptr_t);
va_end(argptr);
switch(vm->type)

View file

@ -2,22 +2,38 @@
#define _VM_H
#ifdef _WIN32
#define EXPORT_FN __cdecl
#define EXPORT_FN __cdecl
#else
#define EXPORT_FN
#define EXPORT_FN
#endif
#if __STDC_VERSION__ >= 199901L
//C99 has a stdint header which hopefully contains an intptr_t
//its optional... but if its not in there then its unlikely you'll actually be able to get the engine to a stage where it *can* load anything
#include <stdint.h>
#define qintptr_t intptr_t
#else
#if defined(_WIN64)
#define qintptr_t __int64
#elif defined(_WIN32)
#define qintptr_t __int32
#else
#if __WORDSIZE == 64
#define qintptr_t long long
#else
#define qintptr_t long
#endif
#endif
#endif
typedef int (EXPORT_FN *sys_calldll_t) (int arg, ...);
typedef int (*sys_callqvm_t) (void *offset, unsigned int mask, int fn, const int *arg);
typedef qintptr_t (EXPORT_FN *sys_calldll_t) (qintptr_t arg, ...);
typedef int (*sys_callqvm_t) (void *offset, unsigned qintptr_t mask, int fn, const int *arg);
typedef struct vm_s vm_t;
// for syscall users
#define VM_LONG(x) (*(int*)&(x))
#define VM_FLOAT(x) (*(float*)&(x))
#define VM_LONG(x) (*(int*)&(x)) //note: on 64bit platforms, the later bits can contain junk
#define VM_FLOAT(x) (*(float*)&(x)) //note: on 64bit platforms, the later bits can contain junk
#define VM_POINTER(x) ((x)?(void*)((char *)offset+((x)%mask)):NULL)
#define VM_OOB(p,l) (p + l >= mask || VM_POINTER(p) < offset)
// ------------------------- * interface * -------------------------
@ -26,7 +42,8 @@ void VM_PrintInfo(vm_t *vm);
vm_t *VM_Create(vm_t *vm, const char *name, sys_calldll_t syscalldll, sys_callqvm_t syscallqvm);
void VM_Destroy(vm_t *vm);
qboolean VM_Restart(vm_t *vm);
int VARGS VM_Call(vm_t *vm, int instruction, ...);
qintptr_t VARGS VM_Call(vm_t *vm, qintptr_t instruction, ...);
qboolean VM_NonNative(vm_t *vm);
void *VM_MemoryBase(vm_t *vm);

View file

@ -50,7 +50,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="MINIMAL;_DEBUG;GLQUAKE;WIN32;_WINDOWS"
RuntimeLibrary="0"
FloatingPointModel="2"
@ -251,7 +251,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="_DEBUG;D3DQUAKE;WIN32;_WINDOWS"
RuntimeLibrary="1"
FloatingPointModel="2"
@ -454,7 +454,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;SWQUAKE"
MinimalRebuild="true"
RuntimeLibrary="1"
@ -659,7 +659,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;SWQUAKE;MINIMAL"
MinimalRebuild="true"
RuntimeLibrary="1"
@ -864,7 +864,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="MINIMAL;NDEBUG;GLQUAKE;WIN32;_WINDOWS"
StringPooling="true"
RuntimeLibrary="0"
@ -1069,8 +1069,8 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="_DEBUG;GLQUAKE;WIN32;_WINDOWS"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="_DEBUG;GLQUAKE;WIN32;_WINDOWS;MULTITHREAD"
RuntimeLibrary="1"
FloatingPointModel="2"
UsePrecompiledHeader="2"
@ -1278,7 +1278,7 @@
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;SERVERONLY"
StringPooling="true"
RuntimeLibrary="0"
@ -1483,7 +1483,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\client,../libs/dxsdk7/include,../libs/dxsdk9/include,../common,../server,../gl,../sw,../qclib,../libs,../d3d,../d3d9"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;GLQUAKE;SWQUAKE;USE_D3D;D3DQUAKE"
StringPooling="true"
RuntimeLibrary="0"
@ -1689,7 +1689,7 @@
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;SWQUAKE"
StringPooling="true"
RuntimeLibrary="0"
@ -1893,7 +1893,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;SERVERONLY"
MinimalRebuild="true"
RuntimeLibrary="0"
@ -2097,7 +2097,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\client,../libs/dxsdk7/include,../libs/dxsdk9/include,../common,../server,../gl,../sw,../qclib,../libs,../d3d,../d3d9"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;GLQUAKE;SWQUAKE;USE_D3D;D3DQUAKE"
RuntimeLibrary="1"
FloatingPointModel="2"
@ -2277,7 +2277,7 @@
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
WholeProgramOptimization="0"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
@ -2307,7 +2307,7 @@
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\client,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
AdditionalIncludeDirectories="..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
PreprocessorDefinitions="NDEBUG;GLQUAKE;WIN32;_WINDOWS"
StringPooling="true"
ExceptionHandling="0"
@ -21788,6 +21788,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\gl\gl_font.c"
>
</File>
<File
RelativePath="..\gl\gl_heightmap.c"
>
@ -25064,6 +25068,7 @@
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
EnableFunctionLevelLinking="true"
/>
</FileConfiguration>
<FileConfiguration

View file

@ -19923,6 +19923,10 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\gl\gl_font.c"
>
</File>
<File
RelativePath="..\gl\gl_heightmap.c"
>

View file

@ -769,8 +769,6 @@ void GLDraw_ReInit (void)
qbyte *ncdata;
qbyte *pal;
qbyte *tinyfont;
extern int solidskytexture;
extern int alphaskytexture;
extern int skyboxtex[6];
extern int *lightmap_textures;
@ -790,8 +788,6 @@ void GLDraw_ReInit (void)
Hash_InitTable(&gltexturetable, sizeof(gltexturetablebuckets)/sizeof(gltexturetablebuckets[0]), gltexturetablebuckets);
solidskytexture=0;
alphaskytexture=0;
skyboxtex[0] = 0; skyboxtex[1] = 0; skyboxtex[2] = 0; skyboxtex[3] = 0; skyboxtex[4] = 0; skyboxtex[5] = 0;
lightmap_textures=NULL;
filmtexture=0;
@ -1186,13 +1182,11 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
TRACE(("dbg: GLDraw_ReInit: PPL_LoadSpecularFragmentProgram\n"));
PPL_CreateShaderObjects();
GL_Warp_Init();
#ifdef PLUGINS
Plug_DrawReloadImages();
#endif
#ifdef AVAIL_FREETYPE
conchar_font = Font_LoadFont(16, "C:/Windows/Fonts/cour.ttf");
#endif
}
void GLDraw_Init (void)
@ -2398,6 +2392,8 @@ void GL_Font_Callback(struct cvar_s *var, char *oldvalue)
GL_Smoothfont_Callback(&gl_smoothfont, "");
GL_Fontinwardstep_Callback(&gl_fontinwardstep, "");
GLVID_Console_Resize();
}
void GL_Conback_Callback(struct cvar_s *var, char *oldvalue)

View file

@ -278,7 +278,7 @@ mleaf_t *GLMod_PointInLeaf (model_t *model, vec3_t p)
void *relightthread;
volatile qboolean wantrelight;
void RelightThread(void *arg)
int RelightThread(void *arg)
{
while (wantrelight && relitsurface < lightmodel->numsurfaces)
{
@ -289,6 +289,7 @@ void RelightThread(void *arg)
lightmodel->surfaces[relitsurface].cached_dlight = -1;
}
return 0;
}
#endif

View file

@ -492,11 +492,15 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex)
}
#endif
static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex, vbo_t *vbo)
static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex, vbo_t *vbo, int fullbright)
{ //doesn't merge surfaces, but tells gl to do each vertex arrayed surface individually, which means no vertex copying.
#if 0
extern cvar_t temp1;
if (temp1.value)
{
int vi;
glRect_t *theRect;
// int first = 0, last = 0;
int first = 0, last = 0;
qglDisableClientState(GL_COLOR_ARRAY);
qglEnableClientState(GL_VERTEX_ARRAY);
@ -505,6 +509,12 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex,
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo->vbocoord);
qglVertexPointer(3, GL_FLOAT, 0, vbo->coord);
GL_MBind(GL_TEXTURE0_ARB, tex->tn.base);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo->vbotexcoord);
qglTexCoordPointer(2, GL_FLOAT, 0, vbo->texcoord);
if (tex->alphaed || currententity->shaderRGBAf[3]<1)
{
if (*tex->name == '{')
@ -525,11 +535,15 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex,
GL_TexEnv(GL_REPLACE);
}
GL_MBind(GL_TEXTURE0_ARB, tex->tn.base);
if (fullbright)
{
GL_MBind(GL_TEXTURE2_ARB, tex->tn.fullbright);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo->vbotexcoord);
//qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo->vbotexcoord);
qglTexCoordPointer(2, GL_FLOAT, 0, vbo->texcoord);
GL_TexEnv(GL_ADD);
qglEnable(GL_TEXTURE_2D);
}
GL_SelectTexture(GL_TEXTURE1_ARB);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
@ -539,6 +553,160 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex,
GL_TexEnv(GL_MODULATE);
/* if (currententity->shaderRGBAf[3]<1)
{
s->lightmaptexturenum = -1;
qglBlendFunc(GL_SRC_COLOR, GL_ONE);
}
*/
if (overbright != 1)
{
GL_TexEnv(GL_COMBINE_ARB);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
qglTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
qglTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
qglTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, overbright); //this is the key
}
// numidxs = 0;
vi = -1;
for (; s ; s=s->texturechain)
{
if (!s->mesh) //urm.
continue;
if (s->mesh->numvertexes <= 1)
continue;
if (vi != s->lightmaptexturenum)
{
if (last != first)
qglDrawElements(GL_TRIANGLES, last - first, GL_INDEX_TYPE, (index_t*)(first*sizeof(index_t)));
last = first;
if (vi<0)
qglEnable(GL_TEXTURE_2D);
vi = s->lightmaptexturenum;
if (vi>=0)
{
GL_Bind(lightmap_textures[vi] );
if (lightmap[vi]->modified)
{
lightmap[vi]->modified = false;
theRect = &lightmap[vi]->rectchange;
qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
LMBLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE,
lightmap[vi]->lightmaps+(theRect->t) *LMBLOCK_WIDTH*lightmap_bytes);
theRect->l = LMBLOCK_WIDTH;
theRect->t = LMBLOCK_HEIGHT;
theRect->h = 0;
theRect->w = 0;
}
}
else
qglDisable(GL_TEXTURE_2D);
}
qglDrawRangeElements(GL_TRIANGLES, s->mesh->vbofirstvert, s->mesh->vbofirstvert+s->mesh->numvertexes-1, s->mesh->numindexes, GL_INDEX_TYPE, vbo->indicies + s->mesh->vbofirstelement);
if (s->mesh->vbofirstelement != last)
{
if (last != first)
qglDrawElements(GL_TRIANGLES, last - first, GL_INDEX_TYPE, (index_t*)(first*sizeof(index_t)));
first = s->mesh->vbofirstelement;
last = first;
}
last += s->mesh->numindexes;
}
if (last != first)
qglDrawElements(GL_TRIANGLES, last - first, GL_INDEX_TYPE, (index_t*)(first*sizeof(index_t)));
//rebinding vbos is meant to be cheap, thankfully
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
if (overbright != 1)
{
qglTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1); //just in case
GL_TexEnv(GL_MODULATE);
}
//tmu 1 should be selected here
qglDisable(GL_TEXTURE_2D);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
if (fullbright)
{
GL_SelectTexture(GL_TEXTURE2_ARB);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
qglDisable(GL_TEXTURE_2D);
}
GL_SelectTexture(GL_TEXTURE0_ARB);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
qglDisable(GL_TEXTURE_2D);
if (tex->alphaed)
qglDisable(GL_ALPHA_TEST);
}
else
#endif
{
int vi;
glRect_t *theRect;
// int first = 0, last = 0;
qglDisableClientState(GL_COLOR_ARRAY);
qglEnableClientState(GL_VERTEX_ARRAY);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, vbo->vboe);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo->vbocoord);
qglVertexPointer(3, GL_FLOAT, 0, vbo->coord);
GL_MBind(GL_TEXTURE0_ARB, tex->tn.base);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo->vbotexcoord);
qglTexCoordPointer(2, GL_FLOAT, 0, vbo->texcoord);
if (tex->alphaed || currententity->shaderRGBAf[3]<1)
{
if (*tex->name == '{')
{
qglEnable(GL_ALPHA_TEST);
qglDisable(GL_BLEND);
GL_TexEnv(GL_REPLACE);
}
else
{
qglEnable(GL_BLEND);
GL_TexEnv(GL_MODULATE);
}
}
else
{
qglDisable(GL_BLEND);
GL_TexEnv(GL_REPLACE);
}
if (fullbright)
{
GL_MBind(GL_TEXTURE2_ARB, tex->tn.fullbright);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
//qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo->vbotexcoord);
qglTexCoordPointer(2, GL_FLOAT, 0, vbo->texcoord);
GL_TexEnv(GL_ADD);
qglEnable(GL_TEXTURE_2D);
}
GL_SelectTexture(GL_TEXTURE1_ARB);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo->vbolmcoord);
qglTexCoordPointer(2, GL_FLOAT, 0, vbo->lmcoord);
GL_TexEnv(GL_MODULATE);
/* if (currententity->shaderRGBAf[3]<1)
{
s->lightmaptexturenum = -1;
@ -618,14 +786,21 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex,
qglDisable(GL_TEXTURE_2D);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
GL_SelectTexture(GL_TEXTURE0_ARB);
if (fullbright)
{
GL_SelectTexture(GL_TEXTURE2_ARB);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
qglDisable(GL_TEXTURE_2D);
}
GL_SelectTexture(GL_TEXTURE0_ARB);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
if (tex->alphaed)
qglDisable(GL_ALPHA_TEST);
}
}
/*
static void PPL_BaseChain_NoBump_2TMU_TEST(msurface_t *s, texture_t *tex)
@ -1829,8 +2004,7 @@ static void PPL_BaseTextureChain(msurface_t *first)
GL_DisableMultitexture();
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_Bind (t->tn.base);
for (; first ; first=first->texturechain)
EmitWaterPolys (first, currententity->shaderRGBAf[3]);
EmitWaterPolyChain (first, currententity->shaderRGBAf[3]);
qglDisable(GL_BLEND);
qglColor4f(1,1,1, 1);
@ -1871,39 +2045,23 @@ static void PPL_BaseTextureChain(msurface_t *first)
{
// PPL_BaseChain_NoBump_2TMU_TEST(first, t);
// PPL_BaseChain_NoBump_2TMU(first, t);
PPL_BaseChain_NoBump_2TMU_Overbright(first, t, &ot->vbo);
}
}
}
static void PPL_FullBrightTextureChain(msurface_t *first)
{
texture_t *ot = first->texinfo->texture;
texture_t *t;
msurface_t *s;
t = R_TextureAnimation (ot);
if (detailtexture && gl_detail.value)
if (gl_mtexarbable>=3)
{
GL_Bind(detailtexture);
qglBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
PPL_EnableVertexArrays();
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stw);
for (s = first; s ; s=s->texturechain)
{
PPL_GenerateDetailArrays(s);
PPL_BaseChain_NoBump_2TMU_Overbright(first, t, &ot->vbo, r_fb_bmodels.value && cls.allow_luma);
return;
}
PPL_BaseChain_NoBump_2TMU_Overbright(first, t, &ot->vbo, false);
}
PPL_FlushArrays();
}
/*if we couldn't draw fullbrights above due to tmu limitations, draw it now*/
if (t->tn.fullbright && r_fb_bmodels.value && cls.allow_luma)
{
msurface_t *s;
GL_Bind(t->tn.fullbright);
qglEnable(GL_BLEND);
qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
if (gl_mylumassuck.value)
qglEnable(GL_ALPHA_TEST);
@ -1925,12 +2083,38 @@ static void PPL_FullBrightTextureChain(msurface_t *first)
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglDisable(GL_BLEND);
if (gl_mylumassuck.value)
qglDisable(GL_ALPHA_TEST);
}
}
static void PPL_DetailTextureChain(msurface_t *first)
{
texture_t *ot = first->texinfo->texture;
texture_t *t;
msurface_t *s;
t = R_TextureAnimation (ot);
if (detailtexture && gl_detail.value)
{
GL_Bind(detailtexture);
qglBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
PPL_EnableVertexArrays();
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stw);
for (s = first; s ; s=s->texturechain)
{
PPL_GenerateDetailArrays(s);
}
PPL_FlushArrays();
}
}
//requires multitexture
void PPL_BaseTextures(model_t *model)
{
@ -3352,7 +3536,7 @@ void PPL_DrawEntLighting(dlight_t *light, vec3_t colour)
}
#endif
void PPL_FullBrights(model_t *model)
void PPL_Details(model_t *model)
{
int tn;
msurface_t *s;
@ -3381,14 +3565,14 @@ void PPL_FullBrights(model_t *model)
if ((s->flags & SURF_DRAWTURB) && r_wateralphaval != 1.0)
continue; // draw translucent water later
PPL_FullBrightTextureChain(s);
PPL_DetailTextureChain(s);
}
GL_TexEnv(GL_REPLACE);
qglDepthMask(1);
}
void PPL_FullBrightBModelTextures(entity_t *e)
void PPL_DetailsBModelTextures(entity_t *e)
{
int i;
model_t *model;
@ -3414,7 +3598,7 @@ void PPL_FullBrightBModelTextures(entity_t *e)
{
if (chain && s->texinfo->texture != chain->texinfo->texture) //last surface or not the same as the next
{
PPL_FullBrightTextureChain(chain);
PPL_DetailTextureChain(chain);
chain = NULL;
}
@ -3423,22 +3607,23 @@ void PPL_FullBrightBModelTextures(entity_t *e)
}
if (chain)
PPL_FullBrightTextureChain(chain);
PPL_DetailTextureChain(chain);
qglPopMatrix();
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
qglDepthMask(1);
}
//draw the bumps on the models for each light.
void PPL_DrawEntFullBrights(void)
//draw the detail textures over the top
void PPL_DrawEntDetails(void)
{
int i;
currententity = &r_worldentity;
if (gl_detail.value || (r_fb_bmodels.value && cls.allow_luma))
PPL_FullBrights(cl.worldmodel);
if (!gl_detail.value)
return;
PPL_Details(cl.worldmodel);
if (!r_drawentities.value)
return;
@ -3474,9 +3659,7 @@ void PPL_DrawEntFullBrights(void)
break;
case mod_brush:
PPL_FullBrightBModelTextures (currententity);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
PPL_DetailsBModelTextures (currententity);
break;
default:
@ -5287,7 +5470,7 @@ void PPL_DrawWorld (void)
PPL_Schematics();
TRACE(("dbg: calling PPL_DrawEntFullBrights\n"));
PPL_DrawEntFullBrights();
PPL_DrawEntDetails();
RSpeedEnd(RSPEED_FULLBRIGHTS);

View file

@ -28,14 +28,14 @@ void R_ReloadRTLights_f(void);
#ifdef WATERLAYERS
cvar_t r_waterlayers = SCVAR("r_waterlayers","3");
cvar_t r_waterlayers = SCVAR("r_waterlayers","");
#endif
extern void R_InitBubble();
#ifndef SWQUAKE
//SW rendering has a faster method, which takes more memory and stuff.
//We need this for minor things though, so we'll just use the slow accurate method.
//We need this for minor things though, so we'5ll just use the slow accurate method.
//this is unlikly to be called very often.
qbyte GetPaletteIndex(int red, int green, int blue)
{
@ -1211,8 +1211,6 @@ TRACE(("dbg: GLR_NewMap: tp\n"));
void GLR_PreNewMap(void)
{
extern int solidskytexture;
solidskytexture = 0;
}

View file

@ -1678,8 +1678,6 @@ store:
*/
extern int solidskytexture;
extern int alphaskytexture;
extern float speedscale; // for top sky and bottom sky
#if 0
@ -1929,8 +1927,7 @@ void GLR_DrawWaterSurfaces (void)
GL_Bind (t->tn.base);
for ( ; s ; s=s->texturechain)
EmitWaterPolys (s, r_wateralphaval);
EmitWaterPolyChain (s, r_wateralphaval);
t->texturechain = NULL;
}
@ -2234,10 +2231,10 @@ void R_MarkLeafSurfaces_Q1 (void)
R_RecursiveWorldNode
================
*/
static void GLR_RecursiveWorldNode (mnode_t *node)
static void GLR_RecursiveWorldNode (mnode_t *node, unsigned int clipflags)
{
int c, side;
mplane_t *plane;
int c, side, clipped;
mplane_t *plane, *clipplane;
msurface_t *surf, **mark;
mleaf_t *pleaf;
double dot;
@ -2250,8 +2247,18 @@ start:
if (node->visframe != r_visframecount)
return;
if (R_CullBox (node->minmaxs, node->minmaxs+3))
for (c = 0, clipplane = frustum; c < 4; c++, clipplane++)
{
if (!(clipflags & (1 << c)))
continue; // don't need to clip against it
clipped = BOX_ON_PLANE_SIDE (node->minmaxs, node->minmaxs + 3, clipplane);
if (clipped == 2)
return;
else if (clipped == 1)
clipflags -= (1<<c); // node is entirely on screen
}
// if a leaf node, draw stuff
if (node->contents < 0)
@ -2302,7 +2309,7 @@ start:
side = 1;
// recurse down the children, front side first
GLR_RecursiveWorldNode (node->children[side]);
GLR_RecursiveWorldNode (node->children[side], clipflags);
// draw stuff
c = node->numsurfaces;
@ -2313,18 +2320,18 @@ start:
shift = GLR_LightmapShift(cl.worldmodel);
// if (dot < 0 -BACKFACE_EPSILON)
// side = SURF_PLANEBACK;
// else if (dot > BACKFACE_EPSILON)
// side = 0;
if (dot < 0 -BACKFACE_EPSILON)
side = SURF_PLANEBACK;
else if (dot > BACKFACE_EPSILON)
side = 0;
{
for ( ; c ; c--, surf++)
{
if (surf->visframe != r_framecount)
continue;
// if (((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK)))
// continue; // wrong side
if (((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK)))
continue; // wrong side
R_RenderDynamicLightmaps (surf, shift);
// if sorting by texture, just store it out
@ -2345,7 +2352,7 @@ start:
}
// recurse down the back side
//GLR_RecursiveWorldNode (node->children[!side]);
//GLR_RecursiveWorldNode (node->children[!side], clipflags);
node = node->children[!side];
goto start;
}
@ -2479,32 +2486,36 @@ static void GLR_LeafWorldNode (void)
mplane_t *clipplane;
for ( pleaf = r_vischain; pleaf; pleaf = pleaf->vischain )
for (pleaf = r_vischain; pleaf; pleaf = pleaf->vischain)
{
// check for door connected areas
// if ( areabits )
// if (areabits)
{
// if (! (areabits[pleaf->area>>3] & (1<<(pleaf->area&7)) ) )
// if (!(areabits[pleaf->area>>3] & (1<<(pleaf->area&7))))
// {
// continue; // not visible
// }
}
clipflags = 15; // 1 | 2 | 4 | 8
// if ( !r_nocull->value )
// if (!r_nocull->value)
{
for (i=0,clipplane=frustum ; i<4 ; i++,clipplane++)
{
clipped = BoxOnPlaneSide ( pleaf->minmaxs, pleaf->minmaxs+3, clipplane );
if ( clipped == 2 ) {
clipped = BoxOnPlaneSide (pleaf->minmaxs, pleaf->minmaxs+3, clipplane);
if (clipped == 2)
{
break;
} else if ( clipped == 1 ) {
}
else if (clipped == 1)
{
clipflags &= ~(1<<i); // node is entirely on screen
}
}
if ( i != 4 ) {
if (i != 4)
{
continue;
}
}
@ -2515,7 +2526,7 @@ static void GLR_LeafWorldNode (void)
do
{
surf = *mark++;
if ( surf->visframe != r_framecount ) //sufraces exist in multiple leafs.
if (surf->visframe != r_framecount) //sufraces exist in multiple leafs.
{
surf->visframe = r_framecount;
@ -2607,7 +2618,7 @@ void R_DrawWorld (void)
R_MarkLeafSurfaces_Q1();
#else
R_MarkLeaves_Q1 ();
GLR_RecursiveWorldNode (cl.worldmodel->nodes);
GLR_RecursiveWorldNode (cl.worldmodel->nodes, 0xf);
#endif
}

View file

@ -102,7 +102,7 @@ void GLVID_Console_Resize(void)
#ifdef AVAIL_FREETYPE
if (conchar_font)
Font_Free(conchar_font);
conchar_font = Font_LoadFont(8*glheight/vid.height, "C:/Windows/Fonts/cour.ttf");
conchar_font = Font_LoadFont(8*glheight/vid.height, gl_font.string);
#endif
#ifdef PLUGINS

View file

@ -33,7 +33,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern void GL_DrawAliasMesh (mesh_t *mesh, int texnum);
static void GL_DrawProgram_WaterChain(msurface_t *fa);
static void GL_DrawProgram_SkyChain(msurface_t *fa);
static void R_CalcSkyChainBounds (msurface_t *s);
static void GL_DrawSkyGrid (texture_t *tex);
static void GL_DrawSkySphere (msurface_t *fa);
static void GL_SkyForceDepth(msurface_t *fa);
void D3D7_DrawSkySphere (msurface_t *fa);
void D3D9_DrawSkySphere (msurface_t *fa);
@ -41,8 +46,6 @@ extern model_t *loadmodel;
int skytexturenum;
int solidskytexture;
int alphaskytexture;
static float speedscale; // for top sky and bottom sky
static float skyrotate;
@ -58,6 +61,13 @@ extern cvar_t r_fastsky;
extern cvar_t r_fastskycolour;
static char defaultskybox[MAX_QPATH];
static int skyprogram;
static int skyprogram_time;
static int skyprogram_eyepos;
static int waterprogram;
static int waterprogram_time;
int skyboxtex[6];
static vec3_t glskycolor;
@ -66,7 +76,7 @@ void GLR_Fastskycolour_Callback(struct cvar_s *var, char *oldvalue)
SCR_StringToRGB(var->string, glskycolor, 255);
}
void GL_DrawSkyBox (msurface_t *s);
static void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
{
int i, j;
@ -85,6 +95,113 @@ static void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
}
}
void GL_Warp_Init(void)
{
char *progtext;
static char *skyglslprog =
"#ifdef VERTEX_SHADER\n"
"varying vec3 pos;\n"
"void main (void)\n"
"{\n"
" pos = gl_Vertex.xyz;\n"
" gl_Position = ftransform();\n"
"}\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"uniform sampler2D solidt;\n"
"uniform sampler2D transt;\n"
"uniform float time;\n"
"uniform vec3 eyepos;\n"
"varying vec3 pos;\n"
"void main (void)\n"
"{\n"
" vec2 tccoord;\n"
" vec3 dir = pos - eyepos;\n"
" dir.z *= 3;\n"
" dir.xy /= 0.5*length(dir);\n"
" tccoord = (dir.xy + time*0.03125);\n"
" vec3 solid = vec3(texture2D(solidt, tccoord));\n"
" tccoord = (dir.xy + time*0.0625);\n"
" vec4 clouds = texture2D(transt, tccoord);\n"
" gl_FragColor.rgb = solid*(1-clouds.a) + clouds.rgb*clouds.a;\n"
"}\n"
"#endif\n"
;
static char *waterglslprog =
"#ifdef VERTEX_SHADER\n"
"varying vec3 pos;\n"
"varying vec2 tc;\n"
"void main (void)\n"
"{\n"
" tc = gl_MultiTexCoord0.st;\n"
" gl_Position = ftransform();\n"
"}\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"uniform sampler2D watertexture;\n"
"uniform float time;\n"
"varying vec2 tc;\n"
"void main (void)\n"
"{\n"
" vec2 ntc;\n"
" ntc.s = tc.s + sin(tc.t+time)*0.125;\n"
" ntc.t = tc.t + sin(tc.s+time)*0.125;\n"
" vec3 ts = vec3(texture2D(watertexture, ntc));\n"
" gl_FragColor.rgb = ts;\n"
"}\n"
"#endif\n"
;
if (FS_LoadFile("quakesky.glsl", &progtext) < 0)
progtext = skyglslprog;
skyprogram = GLSlang_CreateProgram("", progtext, progtext);
if (progtext != skyglslprog)
FS_FreeFile(progtext);
if (skyprogram)
{
GLSlang_UseProgram(skyprogram);
qglUniform1iARB(qglGetUniformLocationARB(skyprogram, "solidt"), 0);
qglUniform1iARB(qglGetUniformLocationARB(skyprogram, "transt"), 1);
skyprogram_time = qglGetUniformLocationARB(skyprogram, "time");
skyprogram_eyepos = qglGetUniformLocationARB(skyprogram, "eyepos");
GLSlang_UseProgram(0);
}
if (FS_LoadFile("quakewater.glsl", &progtext) < 0)
progtext = waterglslprog;
waterprogram = GLSlang_CreateProgram("", progtext, progtext);
if (progtext != waterglslprog)
FS_FreeFile(progtext);
if (waterprogram)
{
GLSlang_UseProgram(waterprogram);
qglUniform1iARB(qglGetUniformLocationARB(waterprogram, "watertexture"), 0);
waterprogram_time = qglGetUniformLocationARB(waterprogram, "time");
GLSlang_UseProgram(0);
}
}
//=========================================================
@ -132,6 +249,15 @@ void EmitWaterPolys (msurface_t *fa, float basealpha)
return;
}
#endif
if (!*r_waterlayers.string)
{
if (waterprogram)
{
GL_DrawProgram_SkyChain(fa);
return;
}
r_waterlayers.value = 3;
}
if (r_waterlayers.value>=1)
{
qglEnable(GL_BLEND); //to ensure.
@ -162,6 +288,80 @@ void EmitWaterPolys (msurface_t *fa, float basealpha)
#endif
void EmitWaterPolyChain (msurface_t *s, float basealpha)
{
float a;
int l;
extern cvar_t r_waterlayers;
#ifdef Q3SHADERS
if (s->texinfo->texture->shader)
{
meshbuffer_t mb;
mb.sortkey = 0;
mb.infokey = 0;
mb.dlightbits = 0;
mb.entity = &r_worldentity;
mb.shader = s->texinfo->texture->shader;
mb.fog = NULL;
mb.mesh = s->mesh;
r_worldentity.shaderRGBAf[3] = basealpha;
while(s)
{
if (R_MeshWillExceed(s->mesh))
R_RenderMeshBuffer(&mb, false);
R_PushMesh(s->mesh, mb.shader->features);
}
r_worldentity.shaderRGBAf[3] = 1;
R_RenderMeshBuffer(&mb, false);
return;
}
#endif
if (!*r_waterlayers.string)
{
if (waterprogram)
{
GL_DrawProgram_WaterChain(s);
return;
}
r_waterlayers.value = 3;
}
if (r_waterlayers.value>=1)
{
msurface_t *fa;
qglEnable(GL_BLEND); //to ensure.
qglMatrixMode(GL_TEXTURE);
for (a=basealpha,l = 0; l < r_waterlayers.value; l++,a=a*4/6)
{
qglPushMatrix();
qglColor4f(1, 1, 1, a);
qglTranslatef (sin(cl.time+l*4) * 0.04f+cos(cl.time/2+l)*0.02f+cl.time/(64+l*8), cos(cl.time+l*4) * 0.06f+sin(cl.time/2+l)*0.02f+cl.time/(16+l*2), 0);
for (fa = s; fa; fa = fa->texturechain)
{
fa->mesh->colors_array=NULL;
GL_DrawAliasMesh(fa->mesh, fa->texinfo->texture->tn.base);
}
qglPopMatrix();
}
qglMatrixMode(GL_MODELVIEW);
qglDisable(GL_BLEND); //to ensure.
}
else //dull (fast) single player
{
msurface_t *fa;
qglMatrixMode(GL_TEXTURE);
qglPushMatrix();
qglTranslatef (sin(cl.time) * 0.4f, cos(cl.time) * 0.06f, 0);
for (fa = s; fa; fa = fa->texturechain)
{
fa->mesh->colors_array=NULL;
GL_DrawAliasMesh(fa->mesh, fa->texinfo->texture->tn.base);
}
qglPopMatrix();
qglMatrixMode(GL_MODELVIEW);
}
}
/*
=================
GL_DrawSkyChain
@ -175,7 +375,7 @@ void GL_DrawSkyChain (msurface_t *s)
GL_DisableMultitexture();
#ifdef Q3SHADERS
if (!solidskytexture&&!usingskybox)
if (!skyboxtex[0] && !usingskybox)
{
int i;
if (s->texinfo->texture->shader && s->texinfo->texture->shader->skydome)
@ -184,12 +384,11 @@ void GL_DrawSkyChain (msurface_t *s)
{
skyboxtex[i] = s->texinfo->texture->shader->skydome->farbox_textures[i];
}
solidskytexture = 1;
}
}
#endif
if (r_fastsky.value||(!solidskytexture&&!usingskybox)) //this is for visability only... we'd otherwise not stoop this low (and this IS low)
if (r_fastsky.value>0) //this is for visability only... we'd otherwise not stoop this low (and this IS low)
{
qglDisable(GL_TEXTURE_2D);
qglColor3f(glskycolor[0], glskycolor[1], glskycolor[2]);
@ -206,13 +405,34 @@ void GL_DrawSkyChain (msurface_t *s)
return;
}
if (usingskybox)
if (skyprogram)
{
R_DrawSkyBoxChain(s);
GL_DrawProgram_SkyChain(s);
return;
}
R_CalcSkyChainBounds(s);
#ifdef RGLQUAKE
if (usingskybox)
if (qrenderer == QR_OPENGL)
{
GL_DrawSkyBox (s);
GL_SkyForceDepth(s);
return;
}
#endif
if (*r_fastsky.string)
{
GL_DrawSkyGrid(s->texinfo->texture);
GL_SkyForceDepth(s);
}
else
{
GL_DrawSkySphere(s);
GL_SkyForceDepth(s);
}
}
#endif
@ -649,7 +869,7 @@ static void ClipSkyPolygon (int nump, vec3_t vecs, int stage)
R_DrawSkyBoxChain
=================
*/
static void R_DrawSkyBoxChain (msurface_t *s)
static void R_CalcSkyChainBounds (msurface_t *s)
{
msurface_t *fa;
@ -671,14 +891,6 @@ static void R_DrawSkyBoxChain (msurface_t *s)
ClipSkyPolygon (3, verts[0], 0);
}
}
#ifdef RGLQUAKE
if (qrenderer == QR_OPENGL)
{
GL_DrawSkyBox (s);
return;
}
#endif
}
#define skygridx 16
@ -855,6 +1067,100 @@ static void gl_skyspherecalc(int skytype)
}
}
static void GL_SkyForceDepth(msurface_t *fa)
{
vbo_t *v;
mesh_t *m;
if (!cls.allow_skyboxes) //allow a little extra fps.
{//Draw the texture chain to only the depth buffer.
v = &fa->texinfo->texture->vbo;
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, v->vboe);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, v->vbocoord);
qglVertexPointer(3, GL_FLOAT, 0, v->coord);
qglDisable(GL_TEXTURE_2D);
if (qglColorMask)
qglColorMask(0,0,0,0);
for (; fa; fa = fa->texturechain)
{
m = fa->mesh;
qglDrawRangeElements(GL_TRIANGLES, m->vbofirstvert, m->vbofirstvert+m->numvertexes, m->numindexes, GL_INDEX_TYPE, v->indicies+m->vbofirstelement);
}
if (qglColorMask)
qglColorMask(1,1,1,1);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
}
}
static void GL_DrawProgram_SkyChain(msurface_t *fa)
{
vbo_t *v;
mesh_t *m;
v = &fa->texinfo->texture->vbo;
qglUseProgramObjectARB(skyprogram);
qglUniform1fARB(skyprogram_time, cl.time);
qglUniform3fvARB(skyprogram_eyepos, 1, r_origin);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, v->vboe);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, v->vbocoord);
qglVertexPointer(3, GL_FLOAT, 0, v->coord);
GL_MBind(mtexid0, fa->texinfo->texture->tn.base);
qglEnable(GL_TEXTURE_2D);
GL_MBind(mtexid1, fa->texinfo->texture->tn.fullbright);
qglEnable(GL_TEXTURE_2D);
for (; fa; fa = fa->texturechain)
{
m = fa->mesh;
qglDrawRangeElements(GL_TRIANGLES, m->vbofirstvert, m->vbofirstvert+m->numvertexes, m->numindexes, GL_INDEX_TYPE, v->indicies+m->vbofirstelement);
}
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglUseProgramObjectARB(0);
qglDisable(GL_TEXTURE_2D);
GL_SelectTexture(mtexid0);
}
static void GL_DrawProgram_WaterChain(msurface_t *fa)
{
vbo_t *v;
mesh_t *m;
v = &fa->texinfo->texture->vbo;
qglUseProgramObjectARB(waterprogram);
qglUniform1fARB(waterprogram_time, cl.time);
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, v->vboe);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, v->vbocoord);
qglVertexPointer(3, GL_FLOAT, 0, v->coord);
GL_MBind(mtexid0, fa->texinfo->texture->tn.base);
qglEnable(GL_TEXTURE_2D);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, v->vbotexcoord);
qglTexCoordPointer(2, GL_FLOAT, 0, v->texcoord);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
for (; fa; fa = fa->texturechain)
{
m = fa->mesh;
qglDrawRangeElements(GL_TRIANGLES, m->vbofirstvert, m->vbofirstvert+m->numvertexes, m->numindexes, GL_INDEX_TYPE, v->indicies+m->vbofirstelement);
}
qglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
qglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
qglUseProgramObjectARB(0);
GL_SelectTexture(mtexid0);
}
static void GL_DrawSkySphere (msurface_t *fa)
{
extern cvar_t gl_maxdist;
@ -894,28 +1200,16 @@ static void GL_DrawSkySphere (msurface_t *fa)
qglMatrixMode(GL_TEXTURE);
qglPushMatrix();
qglTranslatef(time*8/128, time*8/128, 0);
GL_DrawAliasMesh(&skymesh, solidskytexture);
GL_DrawAliasMesh(&skymesh, fa->texinfo->texture->tn.base);
qglColor4f(1,1,1,0.5);
qglEnable(GL_BLEND);
qglTranslatef(time*8/128, time*8/128, 0);
GL_DrawAliasMesh(&skymesh, alphaskytexture);
GL_DrawAliasMesh(&skymesh, fa->texinfo->texture->tn.fullbright);
qglDisable(GL_BLEND);
qglPopMatrix();
qglMatrixMode(GL_MODELVIEW);
}
qglPopMatrix();
if (!cls.allow_skyboxes) //allow a little extra fps.
{//Draw the texture chain to only the depth buffer.
if (qglColorMask)
qglColorMask(0,0,0,0);
for (; fa; fa = fa->texturechain)
{
GL_DrawAliasMesh(fa->mesh, 0);
}
if (qglColorMask)
qglColorMask(1,1,1,1);
}
}
#endif
@ -1096,6 +1390,12 @@ void R_ClearSkyBox (void)
return;
}
for (i=0 ; i<6 ; i++)
{
skymins[0][i] = skymins[1][i] = 9999;
skymaxs[0][i] = skymaxs[1][i] = -9999;
}
if (!skyboxtex[0] || !skyboxtex[1] || !skyboxtex[2] || !skyboxtex[3] || !skyboxtex[4] || !skyboxtex[5])
{
usingskybox = false;
@ -1103,12 +1403,6 @@ void R_ClearSkyBox (void)
}
usingskybox = true;
for (i=0 ; i<6 ; i++)
{
skymins[0][i] = skymins[1][i] = 9999;
skymaxs[0][i] = skymaxs[1][i] = -9999;
}
}
void R_ForceSkyBox (void)
@ -1130,8 +1424,13 @@ static void GL_MakeSkyVec (float s, float t, int axis)
float skydist = gl_skyboxdist.value;
extern cvar_t gl_maxdist;
if (r_shadows.value || !gl_maxdist.value) //because r_shadows comes with an infinate depth perspective.
skydist*=20; //so we can put the distance at whatever distance needed.
if (!skydist)
{
if (r_shadows.value || !gl_maxdist.value)
skydist = 1000000; //inifite distance
else
skydist = gl_maxdist.value * 0.577;
}
b[0] = s*skydist;
b[1] = t*skydist;
@ -1163,6 +1462,140 @@ static void GL_MakeSkyVec (float s, float t, int axis)
qglTexCoord2f (s, t);
qglVertex3fv (v);
}
static void EmitSkyGridVert (vec3_t v)
{
vec3_t dir;
float s, t;
float length;
VectorSubtract (v, r_origin, dir);
dir[2] *= 3; // flatten the sphere
length = VectorLength (dir);
length = 6*63/length;
dir[0] *= length;
dir[1] *= length;
s = (speedscale + dir[0]) * (1.0/128);
t = (speedscale + dir[1]) * (1.0/128);
qglTexCoord2f (s, t);
qglVertex3fv (v);
}
// s and t range from -1 to 1
static void MakeSkyGridVec2 (float s, float t, int axis, vec3_t v)
{
vec3_t b;
int j, k;
float skydist = gl_skyboxdist.value;
extern cvar_t gl_maxdist;
if (!skydist)
{
if (r_shadows.value || !gl_maxdist.value)
skydist = 1000000; //inifite distance
else
skydist = gl_maxdist.value * 0.577;
}
b[0] = s*skydist;
b[1] = t*skydist;
b[2] = skydist;
for (j=0 ; j<3 ; j++)
{
k = st_to_vec[axis][j];
if (k < 0)
v[j] = -b[-k - 1];
else
v[j] = b[k - 1];
v[j] += r_origin[j];
}
}
#define SUBDIVISIONS 10
static void GL_DrawSkyGridFace (int axis)
{
int i, j;
vec3_t vecs[4];
float s, t;
float fstep = 2.0 / SUBDIVISIONS;
qglBegin (GL_QUADS);
for (i = 0; i < SUBDIVISIONS; i++)
{
s = (float)(i*2 - SUBDIVISIONS) / SUBDIVISIONS;
if (s + fstep < skymins[0][axis] || s > skymaxs[0][axis])
continue;
for (j = 0; j < SUBDIVISIONS; j++)
{
t = (float)(j*2 - SUBDIVISIONS) / SUBDIVISIONS;
if (t + fstep < skymins[1][axis] || t > skymaxs[1][axis])
continue;
MakeSkyGridVec2 (s, t, axis, vecs[0]);
MakeSkyGridVec2 (s, t + fstep, axis, vecs[1]);
MakeSkyGridVec2 (s + fstep, t + fstep, axis, vecs[2]);
MakeSkyGridVec2 (s + fstep, t, axis, vecs[3]);
EmitSkyGridVert (vecs[0]);
EmitSkyGridVert (vecs[1]);
EmitSkyGridVert (vecs[2]);
EmitSkyGridVert (vecs[3]);
}
}
qglEnd ();
}
static void GL_DrawSkyGrid (texture_t *tex)
{
int i;
float time = cl.gametime+realtime-cl.gametimemark;
GL_DisableMultitexture();
GL_Bind (tex->tn.base);
speedscale = time*8;
speedscale -= (int)speedscale & ~127;
for (i = 0; i < 6; i++)
{
if ((skymins[0][i] >= skymaxs[0][i] || skymins[1][i] >= skymaxs[1][i]))
continue;
GL_DrawSkyGridFace (i);
}
qglEnable (GL_BLEND);
GL_Bind (tex->tn.fullbright);
speedscale = time*16;
speedscale -= (int)speedscale & ~127;
for (i = 0; i < 6; i++)
{
if ((skymins[0][i] >= skymaxs[0][i] || skymins[1][i] >= skymaxs[1][i]))
continue;
GL_DrawSkyGridFace (i);
}
qglDisable (GL_BLEND);
}
#endif
/*
@ -1174,7 +1607,6 @@ int skytexorder[6] = {0,2,1,3,4,5};
#ifdef RGLQUAKE
void GL_DrawSkyBox (msurface_t *s)
{
msurface_t *fa;
int i;
if (!usingskybox)
@ -1226,18 +1658,6 @@ void GL_DrawSkyBox (msurface_t *s)
}
qglPopMatrix ();
if (!cls.allow_skyboxes && s) //allow a little extra fps.
{
//write the depth correctly
if (qglColorMask)
qglColorMask(0, 0, 0, 0); //depth only.
for (fa = s; fa; fa = fa->texturechain)
GL_DrawAliasMesh(fa->mesh, 1);
if (qglColorMask)
qglColorMask(1, 1, 1, 1);
}
}
#endif
@ -1262,6 +1682,9 @@ void R_InitSky (texture_t *mt)
unsigned *rgba;
char name[MAX_QPATH];
int solidskytexture;
int alphaskytexture;
src = (qbyte *)mt + mt->offsets[0];
// make an average value for the back to avoid
@ -1322,5 +1745,8 @@ void R_InitSky (texture_t *mt)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
*/
mt->tn.base = solidskytexture;
mt->tn.fullbright = alphaskytexture;
}
#endif

View file

@ -331,8 +331,8 @@ void R_IBrokeTheArrays(void);
void GL_DrawSkyBox (msurface_t *s);
void GL_SubdivideSurface (msurface_t *fa, float dividesize);
void GL_EmitBothSkyLayers (msurface_t *fa);
void EmitWaterPolys (msurface_t *fa, float basealpha);
void EmitSkyPolys (msurface_t *fa);
void EmitWaterPolyChain (msurface_t *fa, float basealpha); //chains through the texture chain
void EmitWaterPolys (msurface_t *fa, float basealpha); //don't use if you can avoid it
void GL_DrawSkyChain (msurface_t *s);
void R_InitSky (texture_t *mt);

View file

@ -0,0 +1,64 @@
Special notes to Unix users
===========================
Please read the file `docs/UPGRADE.UNIX'. It contains important
information regarding the installation of FreeType on Unix systems,
especially GNU based operating systems like GNU/Linux.
FreeType 2's library is called `libfreetype', FreeType 1's library
is called `libttf'. They are *not* compatible!
FreeType 2.3.9
==============
Please read the docs/CHANGES file, it contains IMPORTANT
INFORMATION.
Read the files `docs/INSTALL' for installation instructions.
The FreeType 2 API reference is located in `docs/reference'; use the
file `ft2-doc.html' as the top entry point. Additional
documentation is available as a separate package from our sites. Go
to
http://download.savannah.gnu.org/releases/freetype/
and download one of the following files.
freetype-doc-2.3.9.tar.bz2
freetype-doc-2.3.9.tar.gz
ftdoc239.zip
Bugs
====
Please report bugs by e-mail to `freetype-devel@nongnu.org'. Don't
forget to send a detailed explanation of the problem -- there is
nothing worse than receiving a terse message that only says `it
doesn't work'.
Alternatively, you may submit a bug report at
https://savannah.nongnu.org/bugs/?group=freetype
Enjoy!
The FreeType Team
----------------------------------------------------------------------
Copyright 2006, 2007, 2008, 2009 by
David Turner, Robert Wilhelm, and Werner Lemberg.
This file is part of the FreeType project, and may only be used,
modified, and distributed under the terms of the FreeType project
license, LICENSE.TXT. By continuing to use, modify, or distribute
this file you indicate that you have read the license and understand
and accept it fully.
--- end of README ---

View file

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View file

@ -0,0 +1,28 @@
The FreeType 2 font engine is copyrighted work and cannot be used
legally without a software license. In order to make this project
usable to a vast majority of developers, we distribute it under two
mutually exclusive open-source licenses.
This means that *you* must choose *one* of the two licenses described
below, then obey all its terms and conditions when using FreeType 2 in
any of your projects or products.
- The FreeType License, found in the file `FTL.TXT', which is similar
to the original BSD license *with* an advertising clause that forces
you to explicitly cite the FreeType project in your product's
documentation. All details are in the license file. This license
is suited to products which don't use the GNU General Public
License.
- The GNU General Public License version 2, found in `GPL.TXT' (any
later version can be used also), for programs which already use the
GPL. Note that the FTL is incompatible with the GPL due to its
advertisement clause.
The contributed PCF driver comes with a license similar to that of the X
Window System. It is compatible to the above two licenses (see file
src/pcf/readme).
--- end of LICENSE.TXT ---

View file

@ -0,0 +1,500 @@
/***************************************************************************/
/* */
/* ftconfig.h */
/* */
/* ANSI-specific configuration file (specification only). */
/* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This header file contains a number of macro definitions that are used */
/* by the rest of the engine. Most of the macros here are automatically */
/* determined at compile time, and you should not need to change it to */
/* port FreeType, except to compile the library with a non-ANSI */
/* compiler. */
/* */
/* Note however that if some specific modifications are needed, we */
/* advise you to place a modified copy in your build directory. */
/* */
/* The build directory is usually `freetype/builds/<system>', and */
/* contains system-specific files that are always included first when */
/* building the library. */
/* */
/* This ANSI version should stay in `include/freetype/config'. */
/* */
/*************************************************************************/
#ifndef __FTCONFIG_H__
#define __FTCONFIG_H__
#include <ft2build.h>
#include FT_CONFIG_OPTIONS_H
#include FT_CONFIG_STANDARD_LIBRARY_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* PLATFORM-SPECIFIC CONFIGURATION MACROS */
/* */
/* These macros can be toggled to suit a specific system. The current */
/* ones are defaults used to compile FreeType in an ANSI C environment */
/* (16bit compilers are also supported). Copy this file to your own */
/* `freetype/builds/<system>' directory, and edit it to port the engine. */
/* */
/*************************************************************************/
/* There are systems (like the Texas Instruments 'C54x) where a `char' */
/* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */
/* `int' has 16 bits also for this system, sizeof(int) gives 1 which */
/* is probably unexpected. */
/* */
/* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
/* `char' type. */
#ifndef FT_CHAR_BIT
#define FT_CHAR_BIT CHAR_BIT
#endif
/* The size of an `int' type. */
#if FT_UINT_MAX == 0xFFFFUL
#define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
#elif FT_UINT_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
#elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
#define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
#else
#error "Unsupported size of `int' type!"
#endif
/* The size of a `long' type. A five-byte `long' (as used e.g. on the */
/* DM642) is recognized but avoided. */
#if FT_ULONG_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
#elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
#else
#error "Unsupported size of `long' type!"
#endif
/* Preferred alignment of data */
#define FT_ALIGNMENT 8
/* FT_UNUSED is a macro used to indicate that a given parameter is not */
/* used -- this is only used to get rid of unpleasant compiler warnings */
#ifndef FT_UNUSED
#define FT_UNUSED( arg ) ( (arg) = (arg) )
#endif
/*************************************************************************/
/* */
/* AUTOMATIC CONFIGURATION MACROS */
/* */
/* These macros are computed from the ones defined above. Don't touch */
/* their definition, unless you know precisely what you are doing. No */
/* porter should need to mess with them. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* Mac support */
/* */
/* This is the only necessary change, so it is defined here instead */
/* providing a new configuration file. */
/* */
#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
( defined( __MWERKS__ ) && defined( macintosh ) )
/* no Carbon frameworks for 64bit 10.4.x */
#include "AvailabilityMacros.h"
#if defined( __LP64__ ) && \
( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
#define DARWIN_NO_CARBON 1
#else
#define FT_MACINTOSH 1
#endif
#elif defined( __SC__ ) || defined( __MRC__ )
/* Classic MacOS compilers */
#include "ConditionalMacros.h"
#if TARGET_OS_MAC
#define FT_MACINTOSH 1
#endif
#endif
/*************************************************************************/
/* */
/* <Section> */
/* basic_types */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Int16 */
/* */
/* <Description> */
/* A typedef for a 16bit signed integer type. */
/* */
typedef signed short FT_Int16;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UInt16 */
/* */
/* <Description> */
/* A typedef for a 16bit unsigned integer type. */
/* */
typedef unsigned short FT_UInt16;
/* */
/* this #if 0 ... #endif clause is for documentation purposes */
#if 0
/*************************************************************************/
/* */
/* <Type> */
/* FT_Int32 */
/* */
/* <Description> */
/* A typedef for a 32bit signed integer type. The size depends on */
/* the configuration. */
/* */
typedef signed XXX FT_Int32;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UInt32 */
/* */
/* A typedef for a 32bit unsigned integer type. The size depends on */
/* the configuration. */
/* */
typedef unsigned XXX FT_UInt32;
/* */
#endif
#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
typedef signed int FT_Int32;
typedef unsigned int FT_UInt32;
#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)
typedef signed long FT_Int32;
typedef unsigned long FT_UInt32;
#else
#error "no 32bit type found -- please check your configuration files"
#endif
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
typedef int FT_Fast;
typedef unsigned int FT_UFast;
#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)
typedef long FT_Fast;
typedef unsigned long FT_UFast;
#endif
/* determine whether we have a 64-bit int type for platforms without */
/* Autoconf */
#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)
/* FT_LONG64 must be defined if a 64-bit type is available */
#define FT_LONG64
#define FT_INT64 long
#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
/* this compiler provides the __int64 type */
#define FT_LONG64
#define FT_INT64 __int64
#elif defined( __BORLANDC__ ) /* Borland C++ */
/* XXXX: We should probably check the value of __BORLANDC__ in order */
/* to test the compiler version. */
/* this compiler provides the __int64 type */
#define FT_LONG64
#define FT_INT64 __int64
#elif defined( __WATCOMC__ ) /* Watcom C++ */
/* Watcom doesn't provide 64-bit data types */
#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
#define FT_LONG64
#define FT_INT64 long long int
#elif defined( __GNUC__ )
/* GCC provides the `long long' type */
#define FT_LONG64
#define FT_INT64 long long int
#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
/*************************************************************************/
/* */
/* A 64-bit data type will create compilation problems if you compile */
/* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
/* is defined. You can however ignore this rule by defining the */
/* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
/* */
#if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
#ifdef __STDC__
/* undefine the 64-bit macros in strict ANSI compilation mode */
#undef FT_LONG64
#undef FT_INT64
#endif /* __STDC__ */
#endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
#ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
/* Provide assembler fragments for performance-critical functions. */
/* These must be defined `static __inline__' with GCC. */
#ifdef __GNUC__
#if defined( __arm__ ) && !defined( __thumb__ )
#define FT_MULFIX_ASSEMBLER FT_MulFix_arm
/* documentation is in freetype.h */
static __inline__ FT_Int32
FT_MulFix_arm( FT_Int32 a,
FT_Int32 b )
{
register FT_Int32 t, t2;
asm __volatile__ (
"smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
"mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
"add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
"adds %1, %1, %0\n\t" /* %1 += %0 */
"adc %2, %2, #0\n\t" /* %2 += carry */
"mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
"orr %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
: "=r"(a), "=&r"(t2), "=&r"(t)
: "r"(a), "r"(b) );
return a;
}
#endif /* __arm__ && !__thumb__ */
#if defined( i386 )
#define FT_MULFIX_ASSEMBLER FT_MulFix_i386
/* documentation is in freetype.h */
static __inline__ FT_Int32
FT_MulFix_i386( FT_Int32 a,
FT_Int32 b )
{
register FT_Int32 result;
__asm__ __volatile__ (
"imul %%edx\n"
"movl %%edx, %%ecx\n"
"sarl $31, %%ecx\n"
"addl $0x8000, %%ecx\n"
"addl %%ecx, %%eax\n"
"adcl $0, %%edx\n"
"shrl $16, %%eax\n"
"shll $16, %%edx\n"
"addl %%edx, %%eax\n"
: "=a"(result), "=d"(b)
: "a"(a), "d"(b)
: "%ecx", "cc" );
return result;
}
#endif /* i386 */
#endif /* __GNUC__ */
#endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
#ifdef FT_CONFIG_OPTION_INLINE_MULFIX
#ifdef FT_MULFIX_ASSEMBLER
#define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
#endif
#endif
#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
#define FT_LOCAL( x ) static x
#define FT_LOCAL_DEF( x ) static x
#else
#ifdef __cplusplus
#define FT_LOCAL( x ) extern "C" x
#define FT_LOCAL_DEF( x ) extern "C" x
#else
#define FT_LOCAL( x ) extern x
#define FT_LOCAL_DEF( x ) x
#endif
#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
#ifndef FT_BASE
#ifdef __cplusplus
#define FT_BASE( x ) extern "C" x
#else
#define FT_BASE( x ) extern x
#endif
#endif /* !FT_BASE */
#ifndef FT_BASE_DEF
#ifdef __cplusplus
#define FT_BASE_DEF( x ) x
#else
#define FT_BASE_DEF( x ) x
#endif
#endif /* !FT_BASE_DEF */
#ifndef FT_EXPORT
#ifdef __cplusplus
#define FT_EXPORT( x ) extern "C" x
#else
#define FT_EXPORT( x ) extern x
#endif
#endif /* !FT_EXPORT */
#ifndef FT_EXPORT_DEF
#ifdef __cplusplus
#define FT_EXPORT_DEF( x ) extern "C" x
#else
#define FT_EXPORT_DEF( x ) extern x
#endif
#endif /* !FT_EXPORT_DEF */
#ifndef FT_EXPORT_VAR
#ifdef __cplusplus
#define FT_EXPORT_VAR( x ) extern "C" x
#else
#define FT_EXPORT_VAR( x ) extern x
#endif
#endif /* !FT_EXPORT_VAR */
/* The following macros are needed to compile the library with a */
/* C++ compiler and with 16bit compilers. */
/* */
/* This is special. Within C++, you must specify `extern "C"' for */
/* functions which are used via function pointers, and you also */
/* must do that for structures which contain function pointers to */
/* assure C linkage -- it's not possible to have (local) anonymous */
/* functions which are accessed by (global) function pointers. */
/* */
/* */
/* FT_CALLBACK_DEF is used to _define_ a callback function. */
/* */
/* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
/* contains pointers to callback functions. */
/* */
/* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
/* that contains pointers to callback functions. */
/* */
/* */
/* Some 16bit compilers have to redefine these macros to insert */
/* the infamous `_cdecl' or `__fastcall' declarations. */
/* */
#ifndef FT_CALLBACK_DEF
#ifdef __cplusplus
#define FT_CALLBACK_DEF( x ) extern "C" x
#else
#define FT_CALLBACK_DEF( x ) static x
#endif
#endif /* FT_CALLBACK_DEF */
#ifndef FT_CALLBACK_TABLE
#ifdef __cplusplus
#define FT_CALLBACK_TABLE extern "C"
#define FT_CALLBACK_TABLE_DEF extern "C"
#else
#define FT_CALLBACK_TABLE extern
#define FT_CALLBACK_TABLE_DEF /* nothing */
#endif
#endif /* FT_CALLBACK_TABLE */
FT_END_HEADER
#endif /* __FTCONFIG_H__ */
/* END */

View file

@ -0,0 +1,780 @@
/***************************************************************************/
/* */
/* ftheader.h */
/* */
/* Build macros of the FreeType 2 library. */
/* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef __FT_HEADER_H__
#define __FT_HEADER_H__
/*@***********************************************************************/
/* */
/* <Macro> */
/* FT_BEGIN_HEADER */
/* */
/* <Description> */
/* This macro is used in association with @FT_END_HEADER in header */
/* files to ensure that the declarations within are properly */
/* encapsulated in an `extern "C" { .. }' block when included from a */
/* C++ compiler. */
/* */
#ifdef __cplusplus
#define FT_BEGIN_HEADER extern "C" {
#else
#define FT_BEGIN_HEADER /* nothing */
#endif
/*@***********************************************************************/
/* */
/* <Macro> */
/* FT_END_HEADER */
/* */
/* <Description> */
/* This macro is used in association with @FT_BEGIN_HEADER in header */
/* files to ensure that the declarations within are properly */
/* encapsulated in an `extern "C" { .. }' block when included from a */
/* C++ compiler. */
/* */
#ifdef __cplusplus
#define FT_END_HEADER }
#else
#define FT_END_HEADER /* nothing */
#endif
/*************************************************************************/
/* */
/* Aliases for the FreeType 2 public and configuration files. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* header_file_macros */
/* */
/* <Title> */
/* Header File Macros */
/* */
/* <Abstract> */
/* Macro definitions used to #include specific header files. */
/* */
/* <Description> */
/* The following macros are defined to the name of specific */
/* FreeType~2 header files. They can be used directly in #include */
/* statements as in: */
/* */
/* { */
/* #include FT_FREETYPE_H */
/* #include FT_MULTIPLE_MASTERS_H */
/* #include FT_GLYPH_H */
/* } */
/* */
/* There are several reasons why we are now using macros to name */
/* public header files. The first one is that such macros are not */
/* limited to the infamous 8.3~naming rule required by DOS (and */
/* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
/* */
/* The second reason is that it allows for more flexibility in the */
/* way FreeType~2 is installed on a given system. */
/* */
/*************************************************************************/
/* configuration files */
/*************************************************************************
*
* @macro:
* FT_CONFIG_CONFIG_H
*
* @description:
* A macro used in #include statements to name the file containing
* FreeType~2 configuration data.
*
*/
#ifndef FT_CONFIG_CONFIG_H
#define FT_CONFIG_CONFIG_H <freetype/config/ftconfig.h>
#endif
/*************************************************************************
*
* @macro:
* FT_CONFIG_STANDARD_LIBRARY_H
*
* @description:
* A macro used in #include statements to name the file containing
* FreeType~2 interface to the standard C library functions.
*
*/
#ifndef FT_CONFIG_STANDARD_LIBRARY_H
#define FT_CONFIG_STANDARD_LIBRARY_H <freetype/config/ftstdlib.h>
#endif
/*************************************************************************
*
* @macro:
* FT_CONFIG_OPTIONS_H
*
* @description:
* A macro used in #include statements to name the file containing
* FreeType~2 project-specific configuration options.
*
*/
#ifndef FT_CONFIG_OPTIONS_H
#define FT_CONFIG_OPTIONS_H <freetype/config/ftoption.h>
#endif
/*************************************************************************
*
* @macro:
* FT_CONFIG_MODULES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* list of FreeType~2 modules that are statically linked to new library
* instances in @FT_Init_FreeType.
*
*/
#ifndef FT_CONFIG_MODULES_H
#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h>
#endif
/* */
/* public headers */
/*************************************************************************
*
* @macro:
* FT_FREETYPE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* base FreeType~2 API.
*
*/
#define FT_FREETYPE_H <freetype/freetype.h>
/*************************************************************************
*
* @macro:
* FT_ERRORS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* list of FreeType~2 error codes (and messages).
*
* It is included by @FT_FREETYPE_H.
*
*/
#define FT_ERRORS_H <freetype/fterrors.h>
/*************************************************************************
*
* @macro:
* FT_MODULE_ERRORS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* list of FreeType~2 module error offsets (and messages).
*
*/
#define FT_MODULE_ERRORS_H <freetype/ftmoderr.h>
/*************************************************************************
*
* @macro:
* FT_SYSTEM_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 interface to low-level operations (i.e., memory management
* and stream i/o).
*
* It is included by @FT_FREETYPE_H.
*
*/
#define FT_SYSTEM_H <freetype/ftsystem.h>
/*************************************************************************
*
* @macro:
* FT_IMAGE_H
*
* @description:
* A macro used in #include statements to name the file containing type
* definitions related to glyph images (i.e., bitmaps, outlines,
* scan-converter parameters).
*
* It is included by @FT_FREETYPE_H.
*
*/
#define FT_IMAGE_H <freetype/ftimage.h>
/*************************************************************************
*
* @macro:
* FT_TYPES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* basic data types defined by FreeType~2.
*
* It is included by @FT_FREETYPE_H.
*
*/
#define FT_TYPES_H <freetype/fttypes.h>
/*************************************************************************
*
* @macro:
* FT_LIST_H
*
* @description:
* A macro used in #include statements to name the file containing the
* list management API of FreeType~2.
*
* (Most applications will never need to include this file.)
*
*/
#define FT_LIST_H <freetype/ftlist.h>
/*************************************************************************
*
* @macro:
* FT_OUTLINE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* scalable outline management API of FreeType~2.
*
*/
#define FT_OUTLINE_H <freetype/ftoutln.h>
/*************************************************************************
*
* @macro:
* FT_SIZES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API which manages multiple @FT_Size objects per face.
*
*/
#define FT_SIZES_H <freetype/ftsizes.h>
/*************************************************************************
*
* @macro:
* FT_MODULE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* module management API of FreeType~2.
*
*/
#define FT_MODULE_H <freetype/ftmodapi.h>
/*************************************************************************
*
* @macro:
* FT_RENDER_H
*
* @description:
* A macro used in #include statements to name the file containing the
* renderer module management API of FreeType~2.
*
*/
#define FT_RENDER_H <freetype/ftrender.h>
/*************************************************************************
*
* @macro:
* FT_TYPE1_TABLES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* types and API specific to the Type~1 format.
*
*/
#define FT_TYPE1_TABLES_H <freetype/t1tables.h>
/*************************************************************************
*
* @macro:
* FT_TRUETYPE_IDS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* enumeration values which identify name strings, languages, encodings,
* etc. This file really contains a _large_ set of constant macro
* definitions, taken from the TrueType and OpenType specifications.
*
*/
#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
/*************************************************************************
*
* @macro:
* FT_TRUETYPE_TABLES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* types and API specific to the TrueType (as well as OpenType) format.
*
*/
#define FT_TRUETYPE_TABLES_H <freetype/tttables.h>
/*************************************************************************
*
* @macro:
* FT_TRUETYPE_TAGS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of TrueType four-byte `tags' which identify blocks in
* SFNT-based font formats (i.e., TrueType and OpenType).
*
*/
#define FT_TRUETYPE_TAGS_H <freetype/tttags.h>
/*************************************************************************
*
* @macro:
* FT_BDF_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which accesses BDF-specific strings from a
* face.
*
*/
#define FT_BDF_H <freetype/ftbdf.h>
/*************************************************************************
*
* @macro:
* FT_CID_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which access CID font information from a
* face.
*
*/
#define FT_CID_H <freetype/ftcid.h>
/*************************************************************************
*
* @macro:
* FT_GZIP_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which supports gzip-compressed files.
*
*/
#define FT_GZIP_H <freetype/ftgzip.h>
/*************************************************************************
*
* @macro:
* FT_LZW_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which supports LZW-compressed files.
*
*/
#define FT_LZW_H <freetype/ftlzw.h>
/*************************************************************************
*
* @macro:
* FT_WINFONTS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* definitions of an API which supports Windows FNT files.
*
*/
#define FT_WINFONTS_H <freetype/ftwinfnt.h>
/*************************************************************************
*
* @macro:
* FT_GLYPH_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API of the optional glyph management component.
*
*/
#define FT_GLYPH_H <freetype/ftglyph.h>
/*************************************************************************
*
* @macro:
* FT_BITMAP_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API of the optional bitmap conversion component.
*
*/
#define FT_BITMAP_H <freetype/ftbitmap.h>
/*************************************************************************
*
* @macro:
* FT_BBOX_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API of the optional exact bounding box computation routines.
*
*/
#define FT_BBOX_H <freetype/ftbbox.h>
/*************************************************************************
*
* @macro:
* FT_CACHE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* API of the optional FreeType~2 cache sub-system.
*
*/
#define FT_CACHE_H <freetype/ftcache.h>
/*************************************************************************
*
* @macro:
* FT_CACHE_IMAGE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* `glyph image' API of the FreeType~2 cache sub-system.
*
* It is used to define a cache for @FT_Glyph elements. You can also
* use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
* store small glyph bitmaps, as it will use less memory.
*
* This macro is deprecated. Simply include @FT_CACHE_H to have all
* glyph image-related cache declarations.
*
*/
#define FT_CACHE_IMAGE_H FT_CACHE_H
/*************************************************************************
*
* @macro:
* FT_CACHE_SMALL_BITMAPS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* `small bitmaps' API of the FreeType~2 cache sub-system.
*
* It is used to define a cache for small glyph bitmaps in a relatively
* memory-efficient way. You can also use the API defined in
* @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images,
* including scalable outlines.
*
* This macro is deprecated. Simply include @FT_CACHE_H to have all
* small bitmaps-related cache declarations.
*
*/
#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
/*************************************************************************
*
* @macro:
* FT_CACHE_CHARMAP_H
*
* @description:
* A macro used in #include statements to name the file containing the
* `charmap' API of the FreeType~2 cache sub-system.
*
* This macro is deprecated. Simply include @FT_CACHE_H to have all
* charmap-based cache declarations.
*
*/
#define FT_CACHE_CHARMAP_H FT_CACHE_H
/*************************************************************************
*
* @macro:
* FT_MAC_H
*
* @description:
* A macro used in #include statements to name the file containing the
* Macintosh-specific FreeType~2 API. The latter is used to access
* fonts embedded in resource forks.
*
* This header file must be explicitly included by client applications
* compiled on the Mac (note that the base API still works though).
*
*/
#define FT_MAC_H <freetype/ftmac.h>
/*************************************************************************
*
* @macro:
* FT_MULTIPLE_MASTERS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* optional multiple-masters management API of FreeType~2.
*
*/
#define FT_MULTIPLE_MASTERS_H <freetype/ftmm.h>
/*************************************************************************
*
* @macro:
* FT_SFNT_NAMES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* optional FreeType~2 API which accesses embedded `name' strings in
* SFNT-based font formats (i.e., TrueType and OpenType).
*
*/
#define FT_SFNT_NAMES_H <freetype/ftsnames.h>
/*************************************************************************
*
* @macro:
* FT_OPENTYPE_VALIDATE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* optional FreeType~2 API which validates OpenType tables (BASE, GDEF,
* GPOS, GSUB, JSTF).
*
*/
#define FT_OPENTYPE_VALIDATE_H <freetype/ftotval.h>
/*************************************************************************
*
* @macro:
* FT_GX_VALIDATE_H
*
* @description:
* A macro used in #include statements to name the file containing the
* optional FreeType~2 API which validates TrueTypeGX/AAT tables (feat,
* mort, morx, bsln, just, kern, opbd, trak, prop).
*
*/
#define FT_GX_VALIDATE_H <freetype/ftgxval.h>
/*************************************************************************
*
* @macro:
* FT_PFR_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which accesses PFR-specific data.
*
*/
#define FT_PFR_H <freetype/ftpfr.h>
/*************************************************************************
*
* @macro:
* FT_STROKER_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which provides functions to stroke outline paths.
*/
#define FT_STROKER_H <freetype/ftstroke.h>
/*************************************************************************
*
* @macro:
* FT_SYNTHESIS_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs artificial obliquing and emboldening.
*/
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
/*************************************************************************
*
* @macro:
* FT_XFREE86_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which provides functions specific to the XFree86 and
* X.Org X11 servers.
*/
#define FT_XFREE86_H <freetype/ftxf86.h>
/*************************************************************************
*
* @macro:
* FT_TRIGONOMETRY_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs trigonometric computations (e.g.,
* cosines and arc tangents).
*/
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
/*************************************************************************
*
* @macro:
* FT_LCD_FILTER_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs color filtering for subpixel rendering.
*/
#define FT_LCD_FILTER_H <freetype/ftlcdfil.h>
/*************************************************************************
*
* @macro:
* FT_UNPATENTED_HINTING_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs color filtering for subpixel rendering.
*/
#define FT_UNPATENTED_HINTING_H <freetype/ttunpat.h>
/*************************************************************************
*
* @macro:
* FT_INCREMENTAL_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which performs color filtering for subpixel rendering.
*/
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
/*************************************************************************
*
* @macro:
* FT_GASP_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which returns entries from the TrueType GASP table.
*/
#define FT_GASP_H <freetype/ftgasp.h>
/*************************************************************************
*
* @macro:
* FT_ADVANCES_H
*
* @description:
* A macro used in #include statements to name the file containing the
* FreeType~2 API which returns individual and ranged glyph advances.
*/
#define FT_ADVANCES_H <freetype/ftadvanc.h>
/* */
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
/* The internals of the cache sub-system are no longer exposed. We */
/* default to FT_CACHE_H at the moment just in case, but we know of */
/* no rogue client that uses them. */
/* */
#define FT_CACHE_MANAGER_H <freetype/ftcache.h>
#define FT_CACHE_INTERNAL_MRU_H <freetype/ftcache.h>
#define FT_CACHE_INTERNAL_MANAGER_H <freetype/ftcache.h>
#define FT_CACHE_INTERNAL_CACHE_H <freetype/ftcache.h>
#define FT_CACHE_INTERNAL_GLYPH_H <freetype/ftcache.h>
#define FT_CACHE_INTERNAL_IMAGE_H <freetype/ftcache.h>
#define FT_CACHE_INTERNAL_SBITS_H <freetype/ftcache.h>
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
/*
* Include internal headers definitions from <freetype/internal/...>
* only when building the library.
*/
#ifdef FT2_BUILD_LIBRARY
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#include FT_INTERNAL_INTERNAL_H
#endif /* FT2_BUILD_LIBRARY */
#endif /* __FT2_BUILD_H__ */
/* END */

View file

@ -0,0 +1,693 @@
/***************************************************************************/
/* */
/* ftoption.h */
/* */
/* User-selectable configuration macros (specification only). */
/* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef __FTOPTION_H__
#define __FTOPTION_H__
#include <ft2build.h>
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* USER-SELECTABLE CONFIGURATION MACROS */
/* */
/* This file contains the default configuration macro definitions for */
/* a standard build of the FreeType library. There are three ways to */
/* use this file to build project-specific versions of the library: */
/* */
/* - You can modify this file by hand, but this is not recommended in */
/* cases where you would like to build several versions of the */
/* library from a single source directory. */
/* */
/* - You can put a copy of this file in your build directory, more */
/* precisely in `$BUILD/freetype/config/ftoption.h', where `$BUILD' */
/* is the name of a directory that is included _before_ the FreeType */
/* include path during compilation. */
/* */
/* The default FreeType Makefiles and Jamfiles use the build */
/* directory `builds/<system>' by default, but you can easily change */
/* that for your own projects. */
/* */
/* - Copy the file <ft2build.h> to `$BUILD/ft2build.h' and modify it */
/* slightly to pre-define the macro FT_CONFIG_OPTIONS_H used to */
/* locate this file during the build. For example, */
/* */
/* #define FT_CONFIG_OPTIONS_H <myftoptions.h> */
/* #include <freetype/config/ftheader.h> */
/* */
/* will use `$BUILD/myftoptions.h' instead of this file for macro */
/* definitions. */
/* */
/* Note also that you can similarly pre-define the macro */
/* FT_CONFIG_MODULES_H used to locate the file listing of the modules */
/* that are statically linked to the library at compile time. By */
/* default, this file is <freetype/config/ftmodule.h>. */
/* */
/* We highly recommend using the third method whenever possible. */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** G E N E R A L F R E E T Y P E 2 C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* Uncomment the line below if you want to activate sub-pixel rendering */
/* (a.k.a. LCD rendering, or ClearType) in this build of the library. */
/* */
/* Note that this feature is covered by several Microsoft patents */
/* and should not be activated in any default build of the library. */
/* */
/* This macro has no impact on the FreeType API, only on its */
/* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */
/* FT_Render_Glyph still generates a bitmap that is 3 times larger than */
/* the original size; the difference will be that each triplet of */
/* subpixels has R=G=B. */
/* */
/* This is done to allow FreeType clients to run unmodified, forcing */
/* them to display normal gray-level anti-aliased glyphs. */
/* */
/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
/*************************************************************************/
/* */
/* Many compilers provide a non-ANSI 64-bit data type that can be used */
/* by FreeType to speed up some computations. However, this will create */
/* some problems when compiling the library in strict ANSI mode. */
/* */
/* For this reason, the use of 64-bit integers is normally disabled when */
/* the __STDC__ macro is defined. You can however disable this by */
/* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */
/* */
/* For most compilers, this will only create compilation warnings when */
/* building the library. */
/* */
/* ObNote: The compiler-specific 64-bit integers are detected in the */
/* file `ftconfig.h' either statically or through the */
/* `configure' script on supported platforms. */
/* */
#undef FT_CONFIG_OPTION_FORCE_INT64
/*************************************************************************/
/* */
/* If this macro is defined, do not try to use an assembler version of */
/* performance-critical functions (e.g. FT_MulFix). You should only do */
/* that to verify that the assembler function works properly, or to */
/* execute benchmark tests of the various implementations. */
/* #define FT_CONFIG_OPTION_NO_ASSEMBLER */
/*************************************************************************/
/* */
/* If this macro is defined, try to use an inlined assembler version of */
/* the `FT_MulFix' function, which is a `hotspot' when loading and */
/* hinting glyphs, and which should be executed as fast as possible. */
/* */
/* Note that if your compiler or CPU is not supported, this will default */
/* to the standard and portable implementation found in `ftcalc.c'. */
/* */
#define FT_CONFIG_OPTION_INLINE_MULFIX
/*************************************************************************/
/* */
/* LZW-compressed file support. */
/* */
/* FreeType now handles font files that have been compressed with the */
/* `compress' program. This is mostly used to parse many of the PCF */
/* files that come with various X11 distributions. The implementation */
/* uses NetBSD's `zopen' to partially uncompress the file on the fly */
/* (see src/lzw/ftgzip.c). */
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
#define FT_CONFIG_OPTION_USE_LZW
/*************************************************************************/
/* */
/* Gzip-compressed file support. */
/* */
/* FreeType now handles font files that have been compressed with the */
/* `gzip' program. This is mostly used to parse many of the PCF files */
/* that come with XFree86. The implementation uses `zlib' to */
/* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */
/* */
/* Define this macro if you want to enable this `feature'. See also */
/* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
/* */
#define FT_CONFIG_OPTION_USE_ZLIB
/*************************************************************************/
/* */
/* ZLib library selection */
/* */
/* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */
/* It allows FreeType's `ftgzip' component to link to the system's */
/* installation of the ZLib library. This is useful on systems like */
/* Unix or VMS where it generally is already available. */
/* */
/* If you let it undefined, the component will use its own copy */
/* of the zlib sources instead. These have been modified to be */
/* included directly within the component and *not* export external */
/* function names. This allows you to link any program with FreeType */
/* _and_ ZLib without linking conflicts. */
/* */
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
/*************************************************************************/
/* */
/* DLL export compilation */
/* */
/* When compiling FreeType as a DLL, some systems/compilers need a */
/* special keyword in front OR after the return type of function */
/* declarations. */
/* */
/* Two macros are used within the FreeType source code to define */
/* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
/* */
/* FT_EXPORT( return_type ) */
/* */
/* is used in a function declaration, as in */
/* */
/* FT_EXPORT( FT_Error ) */
/* FT_Init_FreeType( FT_Library* alibrary ); */
/* */
/* */
/* FT_EXPORT_DEF( return_type ) */
/* */
/* is used in a function definition, as in */
/* */
/* FT_EXPORT_DEF( FT_Error ) */
/* FT_Init_FreeType( FT_Library* alibrary ) */
/* { */
/* ... some code ... */
/* return FT_Err_Ok; */
/* } */
/* */
/* You can provide your own implementation of FT_EXPORT and */
/* FT_EXPORT_DEF here if you want. If you leave them undefined, they */
/* will be later automatically defined as `extern return_type' to */
/* allow normal compilation. */
/* */
/* Do not #undef these macros here since the build system might define */
/* them for certain configurations only. */
/* */
/* #define FT_EXPORT(x) extern x */
/* #define FT_EXPORT_DEF(x) x */
/*************************************************************************/
/* */
/* Glyph Postscript Names handling */
/* */
/* By default, FreeType 2 is compiled with the `psnames' module. This */
/* module is in charge of converting a glyph name string into a */
/* Unicode value, or return a Macintosh standard glyph name for the */
/* use with the TrueType `post' table. */
/* */
/* Undefine this macro if you do not want `psnames' compiled in your */
/* build of FreeType. This has the following effects: */
/* */
/* - The TrueType driver will provide its own set of glyph names, */
/* if you build it to support postscript names in the TrueType */
/* `post' table. */
/* */
/* - The Type 1 driver will not be able to synthesize a Unicode */
/* charmap out of the glyphs found in the fonts. */
/* */
/* You would normally undefine this configuration macro when building */
/* a version of FreeType that doesn't contain a Type 1 or CFF driver. */
/* */
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Postscript Names to Unicode Values support */
/* */
/* By default, FreeType 2 is built with the `PSNames' module compiled */
/* in. Among other things, the module is used to convert a glyph name */
/* into a Unicode value. This is especially useful in order to */
/* synthesize on the fly a Unicode charmap from the CFF/Type 1 driver */
/* through a big table named the `Adobe Glyph List' (AGL). */
/* */
/* Undefine this macro if you do not want the Adobe Glyph List */
/* compiled in your `PSNames' module. The Type 1 driver will not be */
/* able to synthesize a Unicode charmap out of the glyphs found in the */
/* fonts. */
/* */
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/*************************************************************************/
/* */
/* Support for Mac fonts */
/* */
/* Define this macro if you want support for outline fonts in Mac */
/* format (mac dfont, mac resource, macbinary containing a mac */
/* resource) on non-Mac platforms. */
/* */
/* Note that the `FOND' resource isn't checked. */
/* */
#define FT_CONFIG_OPTION_MAC_FONTS
/*************************************************************************/
/* */
/* Guessing methods to access embedded resource forks */
/* */
/* Enable extra Mac fonts support on non-Mac platforms (e.g. */
/* GNU/Linux). */
/* */
/* Resource forks which include fonts data are stored sometimes in */
/* locations which users or developers don't expected. In some cases, */
/* resource forks start with some offset from the head of a file. In */
/* other cases, the actual resource fork is stored in file different */
/* from what the user specifies. If this option is activated, */
/* FreeType tries to guess whether such offsets or different file */
/* names must be used. */
/* */
/* Note that normal, direct access of resource forks is controlled via */
/* the FT_CONFIG_OPTION_MAC_FONTS option. */
/* */
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
#endif
/*************************************************************************/
/* */
/* Allow the use of FT_Incremental_Interface to load typefaces that */
/* contain no glyph data, but supply it via a callback function. */
/* This allows FreeType to be used with the PostScript language, using */
/* the GhostScript interpreter. */
/* */
/* #define FT_CONFIG_OPTION_INCREMENTAL */
/*************************************************************************/
/* */
/* The size in bytes of the render pool used by the scan-line converter */
/* to do all of its work. */
/* */
/* This must be greater than 4KByte if you use FreeType to rasterize */
/* glyphs; otherwise, you may set it to zero to avoid unnecessary */
/* allocation of the render pool. */
/* */
#define FT_RENDER_POOL_SIZE 16384L
/*************************************************************************/
/* */
/* FT_MAX_MODULES */
/* */
/* The maximum number of modules that can be registered in a single */
/* FreeType library object. 32 is the default. */
/* */
#define FT_MAX_MODULES 32
/*************************************************************************/
/* */
/* Debug level */
/* */
/* FreeType can be compiled in debug or trace mode. In debug mode, */
/* errors are reported through the `ftdebug' component. In trace */
/* mode, additional messages are sent to the standard output during */
/* execution. */
/* */
/* Define FT_DEBUG_LEVEL_ERROR to build the library in debug mode. */
/* Define FT_DEBUG_LEVEL_TRACE to build it in trace mode. */
/* */
/* Don't define any of these macros to compile in `release' mode! */
/* */
/* Do not #undef these macros here since the build system might define */
/* them for certain configurations only. */
/* */
/* #define FT_DEBUG_LEVEL_ERROR */
/* #define FT_DEBUG_LEVEL_TRACE */
/*************************************************************************/
/* */
/* Memory Debugging */
/* */
/* FreeType now comes with an integrated memory debugger that is */
/* capable of detecting simple errors like memory leaks or double */
/* deletes. To compile it within your build of the library, you */
/* should define FT_DEBUG_MEMORY here. */
/* */
/* Note that the memory debugger is only activated at runtime when */
/* when the _environment_ variable `FT2_DEBUG_MEMORY' is defined also! */
/* */
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
/* #define FT_DEBUG_MEMORY */
/*************************************************************************/
/* */
/* Module errors */
/* */
/* If this macro is set (which is _not_ the default), the higher byte */
/* of an error code gives the module in which the error has occurred, */
/* while the lower byte is the real error code. */
/* */
/* Setting this macro makes sense for debugging purposes only, since */
/* it would break source compatibility of certain programs that use */
/* FreeType 2. */
/* */
/* More details can be found in the files ftmoderr.h and fterrors.h. */
/* */
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** S F N T D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_EMBEDDED_BITMAPS if you want to support */
/* embedded bitmaps in all formats using the SFNT module (namely */
/* TrueType & OpenType). */
/* */
#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_POSTSCRIPT_NAMES if you want to be able to */
/* load and enumerate the glyph Postscript names in a TrueType or */
/* OpenType file. */
/* */
/* Note that when you do not compile the `PSNames' module by undefining */
/* the above FT_CONFIG_OPTION_POSTSCRIPT_NAMES, the `sfnt' module will */
/* contain additional code used to read the PS Names table from a font. */
/* */
/* (By default, the module uses `PSNames' to extract glyph names.) */
/* */
#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_SFNT_NAMES if your applications need to */
/* access the internal name table in a SFNT-based format like TrueType */
/* or OpenType. The name table contains various strings used to */
/* describe the font, like family name, copyright, version, etc. It */
/* does not contain any glyph name though. */
/* */
/* Accessing SFNT names is done through the functions declared in */
/* `freetype/ftnames.h'. */
/* */
#define TT_CONFIG_OPTION_SFNT_NAMES
/*************************************************************************/
/* */
/* TrueType CMap support */
/* */
/* Here you can fine-tune which TrueType CMap table format shall be */
/* supported. */
#define TT_CONFIG_CMAP_FORMAT_0
#define TT_CONFIG_CMAP_FORMAT_2
#define TT_CONFIG_CMAP_FORMAT_4
#define TT_CONFIG_CMAP_FORMAT_6
#define TT_CONFIG_CMAP_FORMAT_8
#define TT_CONFIG_CMAP_FORMAT_10
#define TT_CONFIG_CMAP_FORMAT_12
#define TT_CONFIG_CMAP_FORMAT_14
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** T R U E T Y P E D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER if you want to compile */
/* a bytecode interpreter in the TrueType driver. Note that there are */
/* important patent issues related to the use of the interpreter. */
/* */
/* By undefining this, you will only compile the code necessary to load */
/* TrueType glyphs without hinting. */
/* */
/* Do not #undef this macro here, since the build system might */
/* define it for certain configurations only. */
/* */
/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
/*************************************************************************/
/* */
/* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version */
/* of the TrueType bytecode interpreter is used that doesn't implement */
/* any of the patented opcodes and algorithms. Note that the */
/* TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored* if you define */
/* TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words, either define */
/* TT_CONFIG_OPTION_BYTECODE_INTERPRETER or */
/* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time. */
/* */
/* This macro is only useful for a small number of font files (mostly */
/* for Asian scripts) that require bytecode interpretation to properly */
/* load glyphs. For all other fonts, this produces unpleasant results, */
/* thus the unpatented interpreter is never used to load glyphs from */
/* TrueType fonts unless one of the following two options is used. */
/* */
/* - The unpatented interpreter is explicitly activated by the user */
/* through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag */
/* when opening the FT_Face. */
/* */
/* - FreeType detects that the FT_Face corresponds to one of the */
/* `trick' fonts (e.g., `Mingliu') it knows about. The font engine */
/* contains a hard-coded list of font names and other matching */
/* parameters (see function `tt_face_init' in file */
/* `src/truetype/ttobjs.c'). */
/* */
/* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */
/* */
/* { */
/* FT_Parameter parameter; */
/* FT_Open_Args open_args; */
/* */
/* */
/* parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING; */
/* */
/* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; */
/* open_args.pathname = my_font_pathname; */
/* open_args.num_params = 1; */
/* open_args.params = &parameter; */
/* */
/* error = FT_Open_Face( library, &open_args, index, &face ); */
/* ... */
/* } */
/* */
#define TT_CONFIG_OPTION_UNPATENTED_HINTING
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */
/* bytecode interpreter with a huge switch statement, rather than a call */
/* table. This results in smaller and faster code for a number of */
/* architectures. */
/* */
/* Note however that on some compiler/processor combinations, undefining */
/* this macro will generate faster, though larger, code. */
/* */
#define TT_CONFIG_OPTION_INTERPRETER_SWITCH
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the */
/* TrueType glyph loader to use Apple's definition of how to handle */
/* component offsets in composite glyphs. */
/* */
/* Apple and MS disagree on the default behavior of component offsets */
/* in composites. Apple says that they should be scaled by the scaling */
/* factors in the transformation matrix (roughly, it's more complex) */
/* while MS says they should not. OpenType defines two bits in the */
/* composite flags array which can be used to disambiguate, but old */
/* fonts will not have them. */
/* */
/* http://partners.adobe.com/asn/developer/opentype/glyf.html */
/* http://fonts.apple.com/TTRefMan/RM06/Chap6glyf.html */
/* */
#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_GX_VAR_SUPPORT if you want to include */
/* support for Apple's distortable font technology (fvar, gvar, cvar, */
/* and avar tables). This has many similarities to Type 1 Multiple */
/* Masters support. */
/* */
#define TT_CONFIG_OPTION_GX_VAR_SUPPORT
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_BDF if you want to include support for */
/* an embedded `BDF ' table within SFNT-based bitmap formats. */
/* */
#define TT_CONFIG_OPTION_BDF
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** T Y P E 1 D R I V E R C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */
/* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */
/* required. */
/* */
#define T1_MAX_DICT_DEPTH 5
/*************************************************************************/
/* */
/* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
/* calls during glyph loading. */
/* */
#define T1_MAX_SUBRS_CALLS 16
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
/* minimum of 16 is required. */
/* */
/* The Chinese font MingTiEG-Medium (CNS 11643 character set) needs 256. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 256
/*************************************************************************/
/* */
/* Define this configuration macro if you want to prevent the */
/* compilation of `t1afm', which is in charge of reading Type 1 AFM */
/* files into an existing face. Note that if set, the T1 driver will be */
/* unable to produce kerning distances. */
/* */
#undef T1_CONFIG_OPTION_NO_AFM
/*************************************************************************/
/* */
/* Define this configuration macro if you want to prevent the */
/* compilation of the Multiple Masters font support in the Type 1 */
/* driver. */
/* */
#undef T1_CONFIG_OPTION_NO_MM_SUPPORT
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** A U T O F I T M O D U L E C O N F I G U R A T I O N ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* Compile autofit module with CJK (Chinese, Japanese, Korean) script */
/* support. */
/* */
#define AF_CONFIG_OPTION_CJK
/*************************************************************************/
/* */
/* Compile autofit module with Indic script support. */
/* */
#define AF_CONFIG_OPTION_INDIC
/* */
/*
* Define this variable if you want to keep the layout of internal
* structures that was used prior to FreeType 2.2. This also compiles in
* a few obsolete functions to avoid linking problems on typical Unix
* distributions.
*
* For embedded systems or building a new distribution from scratch, it
* is recommended to disable the macro since it reduces the library's code
* size and activates a few memory-saving optimizations as well.
*/
#define FT_CONFIG_OPTION_OLD_INTERNALS
/*
* This macro is defined if either unpatented or native TrueType
* hinting is requested by the definitions above.
*/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#define TT_USE_BYTECODE_INTERPRETER
#undef TT_CONFIG_OPTION_UNPATENTED_HINTING
#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
#define TT_USE_BYTECODE_INTERPRETER
#endif
FT_END_HEADER
#endif /* __FTOPTION_H__ */
/* END */

View file

@ -0,0 +1,172 @@
/***************************************************************************/
/* */
/* ftstdlib.h */
/* */
/* ANSI-specific library and header configuration file (specification */
/* only). */
/* */
/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2009 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file is used to group all #includes to the ANSI C library that */
/* FreeType normally requires. It also defines macros to rename the */
/* standard functions within the FreeType source code. */
/* */
/* Load a file which defines __FTSTDLIB_H__ before this one to override */
/* it. */
/* */
/*************************************************************************/
#ifndef __FTSTDLIB_H__
#define __FTSTDLIB_H__
#include <stddef.h>
#define ft_ptrdiff_t ptrdiff_t
/**********************************************************************/
/* */
/* integer limits */
/* */
/* UINT_MAX and ULONG_MAX are used to automatically compute the size */
/* of `int' and `long' in bytes at compile-time. So far, this works */
/* for all platforms the library has been tested on. */
/* */
/* Note that on the extremely rare platforms that do not provide */
/* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */
/* old Crays where `int' is 36 bits), we do not make any guarantee */
/* about the correct behaviour of FT2 with all fonts. */
/* */
/* In these case, `ftconfig.h' will refuse to compile anyway with a */
/* message like `couldn't find 32-bit type' or something similar. */
/* */
/**********************************************************************/
#include <limits.h>
#define FT_CHAR_BIT CHAR_BIT
#define FT_INT_MAX INT_MAX
#define FT_UINT_MAX UINT_MAX
#define FT_ULONG_MAX ULONG_MAX
/**********************************************************************/
/* */
/* character and string processing */
/* */
/**********************************************************************/
#include <string.h>
#define ft_memchr memchr
#define ft_memcmp memcmp
#define ft_memcpy memcpy
#define ft_memmove memmove
#define ft_memset memset
#define ft_strcat strcat
#define ft_strcmp strcmp
#define ft_strcpy strcpy
#define ft_strlen strlen
#define ft_strncmp strncmp
#define ft_strncpy strncpy
#define ft_strrchr strrchr
#define ft_strstr strstr
/**********************************************************************/
/* */
/* file handling */
/* */
/**********************************************************************/
#include <stdio.h>
#define FT_FILE FILE
#define ft_fclose fclose
#define ft_fopen fopen
#define ft_fread fread
#define ft_fseek fseek
#define ft_ftell ftell
#define ft_sprintf sprintf
/**********************************************************************/
/* */
/* sorting */
/* */
/**********************************************************************/
#include <stdlib.h>
#define ft_qsort qsort
/**********************************************************************/
/* */
/* memory allocation */
/* */
/**********************************************************************/
#define ft_scalloc calloc
#define ft_sfree free
#define ft_smalloc malloc
#define ft_srealloc realloc
/**********************************************************************/
/* */
/* miscellaneous */
/* */
/**********************************************************************/
#define ft_atol atol
#define ft_labs labs
/**********************************************************************/
/* */
/* execution control */
/* */
/**********************************************************************/
#include <setjmp.h>
#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */
/* jmp_buf is defined as a macro */
/* on certain platforms */
#define ft_longjmp longjmp
#define ft_setjmp( b ) setjmp( *(jmp_buf*) &(b) ) /* same thing here */
/* the following is only used for debugging purposes, i.e., if */
/* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */
#include <stdarg.h>
#endif /* __FTSTDLIB_H__ */
/* END */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,239 @@
/***************************************************************************/
/* */
/* fterrdef.h */
/* */
/* FreeType error codes (specification). */
/* */
/* Copyright 2002, 2004, 2006, 2007 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** LIST OF ERROR CODES/MESSAGES *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
/* You need to define both FT_ERRORDEF_ and FT_NOERRORDEF_ before */
/* including this file. */
/* generic errors */
FT_NOERRORDEF_( Ok, 0x00, \
"no error" )
FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \
"cannot open resource" )
FT_ERRORDEF_( Unknown_File_Format, 0x02, \
"unknown file format" )
FT_ERRORDEF_( Invalid_File_Format, 0x03, \
"broken file" )
FT_ERRORDEF_( Invalid_Version, 0x04, \
"invalid FreeType version" )
FT_ERRORDEF_( Lower_Module_Version, 0x05, \
"module version is too low" )
FT_ERRORDEF_( Invalid_Argument, 0x06, \
"invalid argument" )
FT_ERRORDEF_( Unimplemented_Feature, 0x07, \
"unimplemented feature" )
FT_ERRORDEF_( Invalid_Table, 0x08, \
"broken table" )
FT_ERRORDEF_( Invalid_Offset, 0x09, \
"broken offset within table" )
FT_ERRORDEF_( Array_Too_Large, 0x0A, \
"array allocation size too large" )
/* glyph/character errors */
FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \
"invalid glyph index" )
FT_ERRORDEF_( Invalid_Character_Code, 0x11, \
"invalid character code" )
FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \
"unsupported glyph image format" )
FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \
"cannot render this glyph format" )
FT_ERRORDEF_( Invalid_Outline, 0x14, \
"invalid outline" )
FT_ERRORDEF_( Invalid_Composite, 0x15, \
"invalid composite glyph" )
FT_ERRORDEF_( Too_Many_Hints, 0x16, \
"too many hints" )
FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \
"invalid pixel size" )
/* handle errors */
FT_ERRORDEF_( Invalid_Handle, 0x20, \
"invalid object handle" )
FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \
"invalid library handle" )
FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \
"invalid module handle" )
FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \
"invalid face handle" )
FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \
"invalid size handle" )
FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \
"invalid glyph slot handle" )
FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \
"invalid charmap handle" )
FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \
"invalid cache manager handle" )
FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \
"invalid stream handle" )
/* driver errors */
FT_ERRORDEF_( Too_Many_Drivers, 0x30, \
"too many modules" )
FT_ERRORDEF_( Too_Many_Extensions, 0x31, \
"too many extensions" )
/* memory errors */
FT_ERRORDEF_( Out_Of_Memory, 0x40, \
"out of memory" )
FT_ERRORDEF_( Unlisted_Object, 0x41, \
"unlisted object" )
/* stream errors */
FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \
"cannot open stream" )
FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \
"invalid stream seek" )
FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \
"invalid stream skip" )
FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \
"invalid stream read" )
FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \
"invalid stream operation" )
FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \
"invalid frame operation" )
FT_ERRORDEF_( Nested_Frame_Access, 0x57, \
"nested frame access" )
FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \
"invalid frame read" )
/* raster errors */
FT_ERRORDEF_( Raster_Uninitialized, 0x60, \
"raster uninitialized" )
FT_ERRORDEF_( Raster_Corrupted, 0x61, \
"raster corrupted" )
FT_ERRORDEF_( Raster_Overflow, 0x62, \
"raster overflow" )
FT_ERRORDEF_( Raster_Negative_Height, 0x63, \
"negative height while rastering" )
/* cache errors */
FT_ERRORDEF_( Too_Many_Caches, 0x70, \
"too many registered caches" )
/* TrueType and SFNT errors */
FT_ERRORDEF_( Invalid_Opcode, 0x80, \
"invalid opcode" )
FT_ERRORDEF_( Too_Few_Arguments, 0x81, \
"too few arguments" )
FT_ERRORDEF_( Stack_Overflow, 0x82, \
"stack overflow" )
FT_ERRORDEF_( Code_Overflow, 0x83, \
"code overflow" )
FT_ERRORDEF_( Bad_Argument, 0x84, \
"bad argument" )
FT_ERRORDEF_( Divide_By_Zero, 0x85, \
"division by zero" )
FT_ERRORDEF_( Invalid_Reference, 0x86, \
"invalid reference" )
FT_ERRORDEF_( Debug_OpCode, 0x87, \
"found debug opcode" )
FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \
"found ENDF opcode in execution stream" )
FT_ERRORDEF_( Nested_DEFS, 0x89, \
"nested DEFS" )
FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \
"invalid code range" )
FT_ERRORDEF_( Execution_Too_Long, 0x8B, \
"execution context too long" )
FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \
"too many function definitions" )
FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \
"too many instruction definitions" )
FT_ERRORDEF_( Table_Missing, 0x8E, \
"SFNT font table missing" )
FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \
"horizontal header (hhea) table missing" )
FT_ERRORDEF_( Locations_Missing, 0x90, \
"locations (loca) table missing" )
FT_ERRORDEF_( Name_Table_Missing, 0x91, \
"name table missing" )
FT_ERRORDEF_( CMap_Table_Missing, 0x92, \
"character map (cmap) table missing" )
FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \
"horizontal metrics (hmtx) table missing" )
FT_ERRORDEF_( Post_Table_Missing, 0x94, \
"PostScript (post) table missing" )
FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \
"invalid horizontal metrics" )
FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \
"invalid character map (cmap) format" )
FT_ERRORDEF_( Invalid_PPem, 0x97, \
"invalid ppem value" )
FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \
"invalid vertical metrics" )
FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \
"could not find context" )
FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \
"invalid PostScript (post) table format" )
FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \
"invalid PostScript (post) table" )
/* CFF, CID, and Type 1 errors */
FT_ERRORDEF_( Syntax_Error, 0xA0, \
"opcode syntax error" )
FT_ERRORDEF_( Stack_Underflow, 0xA1, \
"argument stack underflow" )
FT_ERRORDEF_( Ignore, 0xA2, \
"ignore" )
/* BDF errors */
FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \
"`STARTFONT' field missing" )
FT_ERRORDEF_( Missing_Font_Field, 0xB1, \
"`FONT' field missing" )
FT_ERRORDEF_( Missing_Size_Field, 0xB2, \
"`SIZE' field missing" )
FT_ERRORDEF_( Missing_Chars_Field, 0xB3, \
"`CHARS' field missing" )
FT_ERRORDEF_( Missing_Startchar_Field, 0xB4, \
"`STARTCHAR' field missing" )
FT_ERRORDEF_( Missing_Encoding_Field, 0xB5, \
"`ENCODING' field missing" )
FT_ERRORDEF_( Missing_Bbx_Field, 0xB6, \
"`BBX' field missing" )
FT_ERRORDEF_( Bbx_Too_Big, 0xB7, \
"`BBX' too big" )
FT_ERRORDEF_( Corrupted_Font_Header, 0xB8, \
"Font header corrupted or missing fields" )
FT_ERRORDEF_( Corrupted_Font_Glyphs, 0xB9, \
"Font glyphs corrupted or missing fields" )
/* END */

View file

@ -0,0 +1,206 @@
/***************************************************************************/
/* */
/* fterrors.h */
/* */
/* FreeType error code handling (specification). */
/* */
/* Copyright 1996-2001, 2002, 2004, 2007 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This special header file is used to define the handling of FT2 */
/* enumeration constants. It can also be used to generate error message */
/* strings with a small macro trick explained below. */
/* */
/* I - Error Formats */
/* ----------------- */
/* */
/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
/* defined in ftoption.h in order to make the higher byte indicate */
/* the module where the error has happened (this is not compatible */
/* with standard builds of FreeType 2). You can then use the macro */
/* FT_ERROR_BASE macro to extract the generic error code from an */
/* FT_Error value. */
/* */
/* */
/* II - Error Message strings */
/* -------------------------- */
/* */
/* The error definitions below are made through special macros that */
/* allow client applications to build a table of error message strings */
/* if they need it. The strings are not included in a normal build of */
/* FreeType 2 to save space (most client applications do not use */
/* them). */
/* */
/* To do so, you have to define the following macros before including */
/* this file: */
/* */
/* FT_ERROR_START_LIST :: */
/* This macro is called before anything else to define the start of */
/* the error list. It is followed by several FT_ERROR_DEF calls */
/* (see below). */
/* */
/* FT_ERROR_DEF( e, v, s ) :: */
/* This macro is called to define one single error. */
/* `e' is the error code identifier (e.g. FT_Err_Invalid_Argument). */
/* `v' is the error numerical value. */
/* `s' is the corresponding error string. */
/* */
/* FT_ERROR_END_LIST :: */
/* This macro ends the list. */
/* */
/* Additionally, you have to undefine __FTERRORS_H__ before #including */
/* this file. */
/* */
/* Here is a simple example: */
/* */
/* { */
/* #undef __FTERRORS_H__ */
/* #define FT_ERRORDEF( e, v, s ) { e, s }, */
/* #define FT_ERROR_START_LIST { */
/* #define FT_ERROR_END_LIST { 0, 0 } }; */
/* */
/* const struct */
/* { */
/* int err_code; */
/* const char* err_msg; */
/* } ft_errors[] = */
/* */
/* #include FT_ERRORS_H */
/* } */
/* */
/*************************************************************************/
#ifndef __FTERRORS_H__
#define __FTERRORS_H__
/* include module base error codes */
#include FT_MODULE_ERRORS_H
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** SETUP MACROS *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#undef FT_NEED_EXTERN_C
#undef FT_ERR_XCAT
#undef FT_ERR_CAT
#define FT_ERR_XCAT( x, y ) x ## y
#define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y )
/* FT_ERR_PREFIX is used as a prefix for error identifiers. */
/* By default, we use `FT_Err_'. */
/* */
#ifndef FT_ERR_PREFIX
#define FT_ERR_PREFIX FT_Err_
#endif
/* FT_ERR_BASE is used as the base for module-specific errors. */
/* */
#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
#ifndef FT_ERR_BASE
#define FT_ERR_BASE FT_Mod_Err_Base
#endif
#else
#undef FT_ERR_BASE
#define FT_ERR_BASE 0
#endif /* FT_CONFIG_OPTION_USE_MODULE_ERRORS */
/* If FT_ERRORDEF is not defined, we need to define a simple */
/* enumeration type. */
/* */
#ifndef FT_ERRORDEF
#define FT_ERRORDEF( e, v, s ) e = v,
#define FT_ERROR_START_LIST enum {
#define FT_ERROR_END_LIST FT_ERR_CAT( FT_ERR_PREFIX, Max ) };
#ifdef __cplusplus
#define FT_NEED_EXTERN_C
extern "C" {
#endif
#endif /* !FT_ERRORDEF */
/* this macro is used to define an error */
#define FT_ERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
/* this is only used for <module>_Err_Ok, which must be 0! */
#define FT_NOERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
#ifdef FT_ERROR_START_LIST
FT_ERROR_START_LIST
#endif
/* now include the error codes */
#include FT_ERROR_DEFINITIONS_H
#ifdef FT_ERROR_END_LIST
FT_ERROR_END_LIST
#endif
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** SIMPLE CLEANUP *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#ifdef FT_NEED_EXTERN_C
}
#endif
#undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST
#undef FT_ERRORDEF
#undef FT_ERRORDEF_
#undef FT_NOERRORDEF_
#undef FT_NEED_EXTERN_C
#undef FT_ERR_CONCAT
#undef FT_ERR_BASE
/* FT_KEEP_ERR_PREFIX is needed for ftvalid.h */
#ifndef FT_KEEP_ERR_PREFIX
#undef FT_ERR_PREFIX
#endif
#endif /* __FTERRORS_H__ */
/* END */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,155 @@
/***************************************************************************/
/* */
/* ftmoderr.h */
/* */
/* FreeType module error offsets (specification). */
/* */
/* Copyright 2001, 2002, 2003, 2004, 2005 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file is used to define the FreeType module error offsets. */
/* */
/* The lower byte gives the error code, the higher byte gives the */
/* module. The base module has error offset 0. For example, the error */
/* `FT_Err_Invalid_File_Format' has value 0x003, the error */
/* `TT_Err_Invalid_File_Format' has value 0x1103, the error */
/* `T1_Err_Invalid_File_Format' has value 0x1203, etc. */
/* */
/* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */
/* to make the higher byte always zero (disabling the module error */
/* mechanism). */
/* */
/* It can also be used to create a module error message table easily */
/* with something like */
/* */
/* { */
/* #undef __FTMODERR_H__ */
/* #define FT_MODERRDEF( e, v, s ) { FT_Mod_Err_ ## e, s }, */
/* #define FT_MODERR_START_LIST { */
/* #define FT_MODERR_END_LIST { 0, 0 } }; */
/* */
/* const struct */
/* { */
/* int mod_err_offset; */
/* const char* mod_err_msg */
/* } ft_mod_errors[] = */
/* */
/* #include FT_MODULE_ERRORS_H */
/* } */
/* */
/* To use such a table, all errors must be ANDed with 0xFF00 to remove */
/* the error code. */
/* */
/*************************************************************************/
#ifndef __FTMODERR_H__
#define __FTMODERR_H__
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** SETUP MACROS *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#undef FT_NEED_EXTERN_C
#ifndef FT_MODERRDEF
#ifdef FT_CONFIG_OPTION_USE_MODULE_ERRORS
#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = v,
#else
#define FT_MODERRDEF( e, v, s ) FT_Mod_Err_ ## e = 0,
#endif
#define FT_MODERR_START_LIST enum {
#define FT_MODERR_END_LIST FT_Mod_Err_Max };
#ifdef __cplusplus
#define FT_NEED_EXTERN_C
extern "C" {
#endif
#endif /* !FT_MODERRDEF */
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** LIST MODULE ERROR BASES *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#ifdef FT_MODERR_START_LIST
FT_MODERR_START_LIST
#endif
FT_MODERRDEF( Base, 0x000, "base module" )
FT_MODERRDEF( Autofit, 0x100, "autofitter module" )
FT_MODERRDEF( BDF, 0x200, "BDF module" )
FT_MODERRDEF( Cache, 0x300, "cache module" )
FT_MODERRDEF( CFF, 0x400, "CFF module" )
FT_MODERRDEF( CID, 0x500, "CID module" )
FT_MODERRDEF( Gzip, 0x600, "Gzip module" )
FT_MODERRDEF( LZW, 0x700, "LZW module" )
FT_MODERRDEF( OTvalid, 0x800, "OpenType validation module" )
FT_MODERRDEF( PCF, 0x900, "PCF module" )
FT_MODERRDEF( PFR, 0xA00, "PFR module" )
FT_MODERRDEF( PSaux, 0xB00, "PS auxiliary module" )
FT_MODERRDEF( PShinter, 0xC00, "PS hinter module" )
FT_MODERRDEF( PSnames, 0xD00, "PS names module" )
FT_MODERRDEF( Raster, 0xE00, "raster module" )
FT_MODERRDEF( SFNT, 0xF00, "SFNT module" )
FT_MODERRDEF( Smooth, 0x1000, "smooth raster module" )
FT_MODERRDEF( TrueType, 0x1100, "TrueType module" )
FT_MODERRDEF( Type1, 0x1200, "Type 1 module" )
FT_MODERRDEF( Type42, 0x1300, "Type 42 module" )
FT_MODERRDEF( Winfonts, 0x1400, "Windows FON/FNT module" )
#ifdef FT_MODERR_END_LIST
FT_MODERR_END_LIST
#endif
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** CLEANUP *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
#ifdef FT_NEED_EXTERN_C
}
#endif
#undef FT_MODERR_START_LIST
#undef FT_MODERR_END_LIST
#undef FT_MODERRDEF
#undef FT_NEED_EXTERN_C
#endif /* __FTMODERR_H__ */
/* END */

View file

@ -0,0 +1,346 @@
/***************************************************************************/
/* */
/* ftsystem.h */
/* */
/* FreeType low-level system interface definition (specification). */
/* */
/* Copyright 1996-2001, 2002, 2005 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef __FTSYSTEM_H__
#define __FTSYSTEM_H__
#include <ft2build.h>
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* system_interface */
/* */
/* <Title> */
/* System Interface */
/* */
/* <Abstract> */
/* How FreeType manages memory and i/o. */
/* */
/* <Description> */
/* This section contains various definitions related to memory */
/* management and i/o access. You need to understand this */
/* information if you want to use a custom memory manager or you own */
/* i/o streams. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* M E M O R Y M A N A G E M E N T */
/* */
/*************************************************************************/
/*************************************************************************
*
* @type:
* FT_Memory
*
* @description:
* A handle to a given memory manager object, defined with an
* @FT_MemoryRec structure.
*
*/
typedef struct FT_MemoryRec_* FT_Memory;
/*************************************************************************
*
* @functype:
* FT_Alloc_Func
*
* @description:
* A function used to allocate `size' bytes from `memory'.
*
* @input:
* memory ::
* A handle to the source memory manager.
*
* size ::
* The size in bytes to allocate.
*
* @return:
* Address of new memory block. 0~in case of failure.
*
*/
typedef void*
(*FT_Alloc_Func)( FT_Memory memory,
long size );
/*************************************************************************
*
* @functype:
* FT_Free_Func
*
* @description:
* A function used to release a given block of memory.
*
* @input:
* memory ::
* A handle to the source memory manager.
*
* block ::
* The address of the target memory block.
*
*/
typedef void
(*FT_Free_Func)( FT_Memory memory,
void* block );
/*************************************************************************
*
* @functype:
* FT_Realloc_Func
*
* @description:
* A function used to re-allocate a given block of memory.
*
* @input:
* memory ::
* A handle to the source memory manager.
*
* cur_size ::
* The block's current size in bytes.
*
* new_size ::
* The block's requested new size.
*
* block ::
* The block's current address.
*
* @return:
* New block address. 0~in case of memory shortage.
*
* @note:
* In case of error, the old block must still be available.
*
*/
typedef void*
(*FT_Realloc_Func)( FT_Memory memory,
long cur_size,
long new_size,
void* block );
/*************************************************************************
*
* @struct:
* FT_MemoryRec
*
* @description:
* A structure used to describe a given memory manager to FreeType~2.
*
* @fields:
* user ::
* A generic typeless pointer for user data.
*
* alloc ::
* A pointer type to an allocation function.
*
* free ::
* A pointer type to an memory freeing function.
*
* realloc ::
* A pointer type to a reallocation function.
*
*/
struct FT_MemoryRec_
{
void* user;
FT_Alloc_Func alloc;
FT_Free_Func free;
FT_Realloc_Func realloc;
};
/*************************************************************************/
/* */
/* I / O M A N A G E M E N T */
/* */
/*************************************************************************/
/*************************************************************************
*
* @type:
* FT_Stream
*
* @description:
* A handle to an input stream.
*
*/
typedef struct FT_StreamRec_* FT_Stream;
/*************************************************************************
*
* @struct:
* FT_StreamDesc
*
* @description:
* A union type used to store either a long or a pointer. This is used
* to store a file descriptor or a `FILE*' in an input stream.
*
*/
typedef union FT_StreamDesc_
{
long value;
void* pointer;
} FT_StreamDesc;
/*************************************************************************
*
* @functype:
* FT_Stream_IoFunc
*
* @description:
* A function used to seek and read data from a given input stream.
*
* @input:
* stream ::
* A handle to the source stream.
*
* offset ::
* The offset of read in stream (always from start).
*
* buffer ::
* The address of the read buffer.
*
* count ::
* The number of bytes to read from the stream.
*
* @return:
* The number of bytes effectively read by the stream.
*
* @note:
* This function might be called to perform a seek or skip operation
* with a `count' of~0.
*
*/
typedef unsigned long
(*FT_Stream_IoFunc)( FT_Stream stream,
unsigned long offset,
unsigned char* buffer,
unsigned long count );
/*************************************************************************
*
* @functype:
* FT_Stream_CloseFunc
*
* @description:
* A function used to close a given input stream.
*
* @input:
* stream ::
* A handle to the target stream.
*
*/
typedef void
(*FT_Stream_CloseFunc)( FT_Stream stream );
/*************************************************************************
*
* @struct:
* FT_StreamRec
*
* @description:
* A structure used to describe an input stream.
*
* @input:
* base ::
* For memory-based streams, this is the address of the first stream
* byte in memory. This field should always be set to NULL for
* disk-based streams.
*
* size ::
* The stream size in bytes.
*
* pos ::
* The current position within the stream.
*
* descriptor ::
* This field is a union that can hold an integer or a pointer. It is
* used by stream implementations to store file descriptors or `FILE*'
* pointers.
*
* pathname ::
* This field is completely ignored by FreeType. However, it is often
* useful during debugging to use it to store the stream's filename
* (where available).
*
* read ::
* The stream's input function.
*
* close ::
* The stream;s close function.
*
* memory ::
* The memory manager to use to preload frames. This is set
* internally by FreeType and shouldn't be touched by stream
* implementations.
*
* cursor ::
* This field is set and used internally by FreeType when parsing
* frames.
*
* limit ::
* This field is set and used internally by FreeType when parsing
* frames.
*
*/
typedef struct FT_StreamRec_
{
unsigned char* base;
unsigned long size;
unsigned long pos;
FT_StreamDesc descriptor;
FT_StreamDesc pathname;
FT_Stream_IoFunc read;
FT_Stream_CloseFunc close;
FT_Memory memory;
unsigned char* cursor;
unsigned char* limit;
} FT_StreamRec;
/* */
FT_END_HEADER
#endif /* __FTSYSTEM_H__ */
/* END */

View file

@ -0,0 +1,587 @@
/***************************************************************************/
/* */
/* fttypes.h */
/* */
/* FreeType simple types definitions (specification only). */
/* */
/* Copyright 1996-2001, 2002, 2004, 2006, 2007, 2008 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef __FTTYPES_H__
#define __FTTYPES_H__
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_SYSTEM_H
#include FT_IMAGE_H
#include <stddef.h>
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* basic_types */
/* */
/* <Title> */
/* Basic Data Types */
/* */
/* <Abstract> */
/* The basic data types defined by the library. */
/* */
/* <Description> */
/* This section contains the basic data types defined by FreeType~2, */
/* ranging from simple scalar types to bitmap descriptors. More */
/* font-specific structures are defined in a different section. */
/* */
/* <Order> */
/* FT_Byte */
/* FT_Bytes */
/* FT_Char */
/* FT_Int */
/* FT_UInt */
/* FT_Int16 */
/* FT_UInt16 */
/* FT_Int32 */
/* FT_UInt32 */
/* FT_Short */
/* FT_UShort */
/* FT_Long */
/* FT_ULong */
/* FT_Bool */
/* FT_Offset */
/* FT_PtrDist */
/* FT_String */
/* FT_Tag */
/* FT_Error */
/* FT_Fixed */
/* FT_Pointer */
/* FT_Pos */
/* FT_Vector */
/* FT_BBox */
/* FT_Matrix */
/* FT_FWord */
/* FT_UFWord */
/* FT_F2Dot14 */
/* FT_UnitVector */
/* FT_F26Dot6 */
/* */
/* */
/* FT_Generic */
/* FT_Generic_Finalizer */
/* */
/* FT_Bitmap */
/* FT_Pixel_Mode */
/* FT_Palette_Mode */
/* FT_Glyph_Format */
/* FT_IMAGE_TAG */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_Bool */
/* */
/* <Description> */
/* A typedef of unsigned char, used for simple booleans. As usual, */
/* values 1 and~0 represent true and false, respectively. */
/* */
typedef unsigned char FT_Bool;
/*************************************************************************/
/* */
/* <Type> */
/* FT_FWord */
/* */
/* <Description> */
/* A signed 16-bit integer used to store a distance in original font */
/* units. */
/* */
typedef signed short FT_FWord; /* distance in FUnits */
/*************************************************************************/
/* */
/* <Type> */
/* FT_UFWord */
/* */
/* <Description> */
/* An unsigned 16-bit integer used to store a distance in original */
/* font units. */
/* */
typedef unsigned short FT_UFWord; /* unsigned distance */
/*************************************************************************/
/* */
/* <Type> */
/* FT_Char */
/* */
/* <Description> */
/* A simple typedef for the _signed_ char type. */
/* */
typedef signed char FT_Char;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Byte */
/* */
/* <Description> */
/* A simple typedef for the _unsigned_ char type. */
/* */
typedef unsigned char FT_Byte;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Bytes */
/* */
/* <Description> */
/* A typedef for constant memory areas. */
/* */
typedef const FT_Byte* FT_Bytes;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Tag */
/* */
/* <Description> */
/* A typedef for 32-bit tags (as used in the SFNT format). */
/* */
typedef FT_UInt32 FT_Tag;
/*************************************************************************/
/* */
/* <Type> */
/* FT_String */
/* */
/* <Description> */
/* A simple typedef for the char type, usually used for strings. */
/* */
typedef char FT_String;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Short */
/* */
/* <Description> */
/* A typedef for signed short. */
/* */
typedef signed short FT_Short;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UShort */
/* */
/* <Description> */
/* A typedef for unsigned short. */
/* */
typedef unsigned short FT_UShort;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Int */
/* */
/* <Description> */
/* A typedef for the int type. */
/* */
typedef signed int FT_Int;
/*************************************************************************/
/* */
/* <Type> */
/* FT_UInt */
/* */
/* <Description> */
/* A typedef for the unsigned int type. */
/* */
typedef unsigned int FT_UInt;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Long */
/* */
/* <Description> */
/* A typedef for signed long. */
/* */
typedef signed long FT_Long;
/*************************************************************************/
/* */
/* <Type> */
/* FT_ULong */
/* */
/* <Description> */
/* A typedef for unsigned long. */
/* */
typedef unsigned long FT_ULong;
/*************************************************************************/
/* */
/* <Type> */
/* FT_F2Dot14 */
/* */
/* <Description> */
/* A signed 2.14 fixed float type used for unit vectors. */
/* */
typedef signed short FT_F2Dot14;
/*************************************************************************/
/* */
/* <Type> */
/* FT_F26Dot6 */
/* */
/* <Description> */
/* A signed 26.6 fixed float type used for vectorial pixel */
/* coordinates. */
/* */
typedef signed long FT_F26Dot6;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Fixed */
/* */
/* <Description> */
/* This type is used to store 16.16 fixed float values, like scaling */
/* values or matrix coefficients. */
/* */
typedef signed long FT_Fixed;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Error */
/* */
/* <Description> */
/* The FreeType error code type. A value of~0 is always interpreted */
/* as a successful operation. */
/* */
typedef int FT_Error;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Pointer */
/* */
/* <Description> */
/* A simple typedef for a typeless pointer. */
/* */
typedef void* FT_Pointer;
/*************************************************************************/
/* */
/* <Type> */
/* FT_Offset */
/* */
/* <Description> */
/* This is equivalent to the ANSI~C `size_t' type, i.e., the largest */
/* _unsigned_ integer type used to express a file size or position, */
/* or a memory block size. */
/* */
typedef size_t FT_Offset;
/*************************************************************************/
/* */
/* <Type> */
/* FT_PtrDist */
/* */
/* <Description> */
/* This is equivalent to the ANSI~C `ptrdiff_t' type, i.e., the */
/* largest _signed_ integer type used to express the distance */
/* between two pointers. */
/* */
typedef ft_ptrdiff_t FT_PtrDist;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_UnitVector */
/* */
/* <Description> */
/* A simple structure used to store a 2D vector unit vector. Uses */
/* FT_F2Dot14 types. */
/* */
/* <Fields> */
/* x :: Horizontal coordinate. */
/* */
/* y :: Vertical coordinate. */
/* */
typedef struct FT_UnitVector_
{
FT_F2Dot14 x;
FT_F2Dot14 y;
} FT_UnitVector;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Matrix */
/* */
/* <Description> */
/* A simple structure used to store a 2x2 matrix. Coefficients are */
/* in 16.16 fixed float format. The computation performed is: */
/* */
/* { */
/* x' = x*xx + y*xy */
/* y' = x*yx + y*yy */
/* } */
/* */
/* <Fields> */
/* xx :: Matrix coefficient. */
/* */
/* xy :: Matrix coefficient. */
/* */
/* yx :: Matrix coefficient. */
/* */
/* yy :: Matrix coefficient. */
/* */
typedef struct FT_Matrix_
{
FT_Fixed xx, xy;
FT_Fixed yx, yy;
} FT_Matrix;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Data */
/* */
/* <Description> */
/* Read-only binary data represented as a pointer and a length. */
/* */
/* <Fields> */
/* pointer :: The data. */
/* */
/* length :: The length of the data in bytes. */
/* */
typedef struct FT_Data_
{
const FT_Byte* pointer;
FT_Int length;
} FT_Data;
/*************************************************************************/
/* */
/* <FuncType> */
/* FT_Generic_Finalizer */
/* */
/* <Description> */
/* Describe a function used to destroy the `client' data of any */
/* FreeType object. See the description of the @FT_Generic type for */
/* details of usage. */
/* */
/* <Input> */
/* The address of the FreeType object which is under finalization. */
/* Its client data is accessed through its `generic' field. */
/* */
typedef void (*FT_Generic_Finalizer)(void* object);
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Generic */
/* */
/* <Description> */
/* Client applications often need to associate their own data to a */
/* variety of FreeType core objects. For example, a text layout API */
/* might want to associate a glyph cache to a given size object. */
/* */
/* Most FreeType object contains a `generic' field, of type */
/* FT_Generic, which usage is left to client applications and font */
/* servers. */
/* */
/* It can be used to store a pointer to client-specific data, as well */
/* as the address of a `finalizer' function, which will be called by */
/* FreeType when the object is destroyed (for example, the previous */
/* client example would put the address of the glyph cache destructor */
/* in the `finalizer' field). */
/* */
/* <Fields> */
/* data :: A typeless pointer to any client-specified data. This */
/* field is completely ignored by the FreeType library. */
/* */
/* finalizer :: A pointer to a `generic finalizer' function, which */
/* will be called when the object is destroyed. If this */
/* field is set to NULL, no code will be called. */
/* */
typedef struct FT_Generic_
{
void* data;
FT_Generic_Finalizer finalizer;
} FT_Generic;
/*************************************************************************/
/* */
/* <Macro> */
/* FT_MAKE_TAG */
/* */
/* <Description> */
/* This macro converts four-letter tags which are used to label */
/* TrueType tables into an unsigned long to be used within FreeType. */
/* */
/* <Note> */
/* The produced values *must* be 32-bit integers. Don't redefine */
/* this macro. */
/* */
#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
( ( (FT_ULong)_x1 << 24 ) | \
( (FT_ULong)_x2 << 16 ) | \
( (FT_ULong)_x3 << 8 ) | \
(FT_ULong)_x4 )
/*************************************************************************/
/*************************************************************************/
/* */
/* L I S T M A N A G E M E N T */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Section> */
/* list_processing */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FT_ListNode */
/* */
/* <Description> */
/* Many elements and objects in FreeType are listed through an */
/* @FT_List record (see @FT_ListRec). As its name suggests, an */
/* FT_ListNode is a handle to a single list element. */
/* */
typedef struct FT_ListNodeRec_* FT_ListNode;
/*************************************************************************/
/* */
/* <Type> */
/* FT_List */
/* */
/* <Description> */
/* A handle to a list record (see @FT_ListRec). */
/* */
typedef struct FT_ListRec_* FT_List;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_ListNodeRec */
/* */
/* <Description> */
/* A structure used to hold a single list element. */
/* */
/* <Fields> */
/* prev :: The previous element in the list. NULL if first. */
/* */
/* next :: The next element in the list. NULL if last. */
/* */
/* data :: A typeless pointer to the listed object. */
/* */
typedef struct FT_ListNodeRec_
{
FT_ListNode prev;
FT_ListNode next;
void* data;
} FT_ListNodeRec;
/*************************************************************************/
/* */
/* <Struct> */
/* FT_ListRec */
/* */
/* <Description> */
/* A structure used to hold a simple doubly-linked list. These are */
/* used in many parts of FreeType. */
/* */
/* <Fields> */
/* head :: The head (first element) of doubly-linked list. */
/* */
/* tail :: The tail (last element) of doubly-linked list. */
/* */
typedef struct FT_ListRec_
{
FT_ListNode head;
FT_ListNode tail;
} FT_ListRec;
/* */
#define FT_IS_EMPTY( list ) ( (list).head == 0 )
/* return base error code (without module-specific prefix) */
#define FT_ERROR_BASE( x ) ( (x) & 0xFF )
/* return module error code */
#define FT_ERROR_MODULE( x ) ( (x) & 0xFF00U )
#define FT_BOOL( x ) ( (FT_Bool)( x ) )
FT_END_HEADER
#endif /* __FTTYPES_H__ */
/* END */

View file

@ -0,0 +1,39 @@
/***************************************************************************/
/* */
/* ft2build.h */
/* */
/* FreeType 2 build and setup macros. */
/* (Generic version) */
/* */
/* Copyright 1996-2001, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file corresponds to the default `ft2build.h' file for */
/* FreeType 2. It uses the `freetype' include root. */
/* */
/* Note that specific platforms might use a different configuration. */
/* See builds/unix/ft2unix.h for an example. */
/* */
/*************************************************************************/
#ifndef __FT2_BUILD_GENERIC_H__
#define __FT2_BUILD_GENERIC_H__
#include <freetype/config/ftheader.h>
#endif /* __FT2_BUILD_GENERIC_H__ */
/* END */

View file

@ -2141,19 +2141,14 @@ single print to a specific client
centerprint(clientent, value)
=================
*/
void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_centerprint_Internal (int entnum, char *s)
{
char *s;
int entnum;
client_t *cl, *sp;
int slen;
if (sv.demofile)
return;
entnum = G_EDICTNUM(prinst, OFS_PARM0);
s = PF_VarString(prinst, 1, pr_globals);
if (entnum < 1 || entnum > sv.allocated_client_slots)
{
Con_TPrintf (STL_BADSPRINT);
@ -2194,6 +2189,18 @@ void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
}
void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *s;
int entnum;
client_t *cl, *sp;
int slen;
entnum = G_EDICTNUM(prinst, OFS_PARM0);
s = PF_VarString(prinst, 1, pr_globals);
PF_centerprint_Internal(entnum, s);
}
/*
=================
PF_vhlen
@ -2487,18 +2494,10 @@ PF_ambientsound
=================
*/
void PF_ambientsound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_ambientsound_Internal (float *pos, char *samp, float vol, float attenuation)
{
char *samp;
float *pos;
float vol, attenuation;
int i, soundnum;
pos = G_VECTOR (OFS_PARM0);
samp = PR_GetStringOfs(prinst, OFS_PARM1);
vol = G_FLOAT(OFS_PARM2);
attenuation = G_FLOAT(OFS_PARM3);
// check to see if samp was properly precached
for (soundnum=1 ; *sv.strings.sound_precache[soundnum] ; soundnum++)
if (!strcmp(sv.strings.sound_precache[soundnum],samp))
@ -2525,6 +2524,20 @@ void PF_ambientsound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
void PF_ambientsound (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *samp;
float *pos;
float vol, attenuation;
pos = G_VECTOR (OFS_PARM0);
samp = PR_GetStringOfs(prinst, OFS_PARM1);
vol = G_FLOAT(OFS_PARM2);
attenuation = G_FLOAT(OFS_PARM3);
PF_ambientsound_Internal(pos, samp, vol, attenuation);
}
/*
=================
PF_sound
@ -3976,15 +3989,13 @@ sizebuf_t *NQWriteDest (int dest)
}
#endif
struct globalvars_s *pr_netglob;
progfuncs_t *pr_netprogfuncs;
client_t *Write_GetClient(void)
{
int entnum;
edict_t *ent;
ent = PROG_TO_EDICT(pr_netprogfuncs, pr_global_struct->msg_entity);
entnum = NUM_FOR_EDICT(pr_netprogfuncs, ent);
ent = PROG_TO_EDICT(svprogfuncs, pr_global_struct->msg_entity);
entnum = NUM_FOR_EDICT(svprogfuncs, ent);
if (entnum < 1 || entnum > sv.allocated_client_slots)
return NULL;//PR_RunError ("WriteDest: not a client");
return &svs.clients[entnum-1];
@ -4002,8 +4013,6 @@ void PF_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (qc_nonetaccess.value || sv.demofile)
return;
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (progstype == PROG_NQ || progstype == PROG_H2)
{
NPP_NQWriteByte(G_FLOAT(OFS_PARM0), (qbyte)G_FLOAT(OFS_PARM1));
@ -4039,8 +4048,6 @@ void PF_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (qc_nonetaccess.value || sv.demofile)
return;
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (progstype == PROG_NQ || progstype == PROG_H2)
{
NPP_NQWriteChar(G_FLOAT(OFS_PARM0), (char)G_FLOAT(OFS_PARM1));
@ -4077,8 +4084,6 @@ void PF_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (qc_nonetaccess.value || sv.demofile)
return;
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (progstype == PROG_NQ || progstype == PROG_H2)
{
NPP_NQWriteShort(G_FLOAT(OFS_PARM0), (short)(int)G_FLOAT(OFS_PARM1));
@ -4115,8 +4120,6 @@ void PF_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (qc_nonetaccess.value || sv.demofile)
return;
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (progstype == PROG_NQ || progstype == PROG_H2)
{
NPP_NQWriteLong(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1));
@ -4152,8 +4155,6 @@ void PF_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (qc_nonetaccess.value || sv.demofile)
return;
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (progstype == PROG_NQ || progstype == PROG_H2)
{
NPP_NQWriteAngle(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1));
@ -4190,8 +4191,6 @@ void PF_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (qc_nonetaccess.value || sv.demofile)
return;
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (progstype == PROG_NQ || progstype == PROG_H2)
{
NPP_NQWriteCoord(G_FLOAT(OFS_PARM0), G_FLOAT(OFS_PARM1));
@ -4217,10 +4216,9 @@ void PF_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals)
#endif
}
void PF_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
void PF_WriteString_Internal (int target, char *str)
{
char *str = PF_VarString(prinst, 1, pr_globals);;
if (G_FLOAT(OFS_PARM0) == MSG_CSQC)
if (target == MSG_CSQC)
{ //csqc buffers are always written.
MSG_WriteString(&csqcmsgbuffer, str);
return;
@ -4229,21 +4227,19 @@ void PF_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (qc_nonetaccess.value || sv.demofile)
return;
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (progstype == PROG_NQ || progstype == PROG_H2)
{
NPP_NQWriteString(G_FLOAT(OFS_PARM0), str);
NPP_NQWriteString(target, str);
return;
}
#ifdef NQPROT
else
{
NPP_QWWriteString(G_FLOAT(OFS_PARM0), str);
NPP_QWWriteString(target, str);
return;
}
#else
if (G_FLOAT(OFS_PARM0) == MSG_ONE)
if (target == MSG_ONE)
{
client_t *cl = Write_GetClient();
if (!cl)
@ -4252,10 +4248,16 @@ void PF_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
ClientReliableWrite_String(cl, str);
}
else
MSG_WriteString (QWWriteDest(G_FLOAT(OFS_PARM0)), str);
MSG_WriteString (QWWriteDest(target), str);
#endif
}
void PF_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *str = PF_VarString(prinst, 1, pr_globals);
PF_WriteString_Internal(G_FLOAT(OFS_PARM0), str);
}
void PF_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -4268,8 +4270,6 @@ void PF_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
if (qc_nonetaccess.value || sv.demofile)
return;
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (progstype == PROG_NQ || progstype == PROG_H2)
{
NPP_NQWriteEntity(G_FLOAT(OFS_PARM0), (short)G_EDICTNUM(prinst, OFS_PARM1));
@ -6873,9 +6873,6 @@ void PF_plaque_draw(progfuncs_t *prinst, struct globalvars_s *pr_globals)
else
s = T_GetString(G_FLOAT(OFS_PARM1)-1);
pr_netprogfuncs = prinst;
pr_netglob = pr_globals;
if (G_FLOAT(OFS_PARM0) == MSG_ONE)
{
client_t *cl = Write_GetClient();

View file

@ -28,9 +28,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define VMFSID_Q1QVM 57235 //a cookie
#define WASTED_EDICT_T_SIZE sizeof(void*) //qclib has split edict_t and entvars_t.
#if GAME_API_VERSION >= 13
#define WASTED_EDICT_T_SIZE (VM_NonNative(q1qvm)?sizeof(int):sizeof(void*))
//in version 13, the actual edict_t struct is gone, and there's a pointer to it in its place (which we don't need, but it changes size based on vm/native).
#else
//this is probably broken on 64bit native code
#define WASTED_EDICT_T_SIZE 114
//qclib has split edict_t and entvars_t.
//mvdsv and the api we're implementing has them in one lump
//so we need to bias our entvars_t and fake the offsets a little.
#endif
//===============================================================
@ -180,6 +187,7 @@ typedef enum
GAME_EDICT_THINK, //(self,other=world,time)
GAME_EDICT_BLOCKED, //(self,other)
GAME_CLIENT_SAY, //(int isteam)
GAME_PAUSED_TIC, //(int milliseconds)
} gameExport_t;
@ -264,10 +272,10 @@ typedef struct {
} q1qvmglobalvars_t;
//this is not usable in 64bit to refer to a 32bit qvm (hence why we have two versions).
//this is not directly usable in 64bit to refer to a 32bit qvm (hence why we have two versions).
typedef struct
{
edict_t *ents;
struct vmedict_s *ents;
int sizeofent;
q1qvmglobalvars_t *global;
field_t *fields;
@ -318,7 +326,7 @@ static edict_t *q1qvmedicts[MAX_Q1QVM_EDICTS];
static void *evars; //pointer to the gamecodes idea of an edict_t
static int vevars; //offset into the vm base of evars
static qintptr_t vevars; //offset into the vm base of evars
/*
static char *Q1QVMPF_AddString(progfuncs_t *pf, char *base, int minlength)
@ -491,13 +499,12 @@ void PF_changelevel (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_set (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_cvar_setf (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_lightstyle (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ambientsound (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_applylightstyle(int style, char *val, int col);
void PF_ambientsound_Internal (float *pos, char *samp, float vol, float attenuation);
void PF_makestatic (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_logfrag (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_centerprint (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_localcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_ExecuteCommand (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_setspawnparms (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_walkmove (progfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -511,7 +518,7 @@ void PF_precache_model_Internal (progfuncs_t *prinst, char *s);
void PF_setmodel_Internal (progfuncs_t *prinst, edict_t *e, char *m);
char *PF_infokey_Internal (int entnum, char *value);;
static int WrapQCBuiltin(builtin_t func, void *offset, unsigned int mask, const int *arg, char *argtypes)
static int WrapQCBuiltin(builtin_t func, void *offset, unsigned qintptr_t mask, const qintptr_t *arg, char *argtypes)
{
globalvars_t gv;
int argnum=0;
@ -534,7 +541,7 @@ static int WrapQCBuiltin(builtin_t func, void *offset, unsigned int mask, const
gv.param[argnum].vec[2] = VM_FLOAT(*arg++);
argnum++;
break;
case 's': //three seperate args -> 1 vector
case 's':
gv.param[argnum].i = VM_LONG(*arg++);
argnum++;
break;
@ -546,8 +553,8 @@ static int WrapQCBuiltin(builtin_t func, void *offset, unsigned int mask, const
return gv.ret.i;
}
#define VALIDATEPOINTER(o,l) if ((int)o + l >= mask || VM_POINTER(o) < offset) SV_Error("Call to game trap %i passes invalid pointer\n", fn); //out of bounds.
static int syscallqvm (void *offset, unsigned int mask, int fn, const int *arg)
#define VALIDATEPOINTER(o,l) if ((qintptr_t)o + l >= mask || VM_POINTER(o) < offset) SV_Error("Call to game trap %i passes invalid pointer\n", fn); //out of bounds.
static qintptr_t syscallhandle (void *offset, unsigned qintptr_t mask, qintptr_t fn, const qintptr_t *arg)
{
switch (fn)
{
@ -600,12 +607,12 @@ static int syscallqvm (void *offset, unsigned int mask, int fn, const int *arg)
break;
case G_LIGHTSTYLE:
WrapQCBuiltin(PF_lightstyle, offset, mask, arg, "is");
PF_applylightstyle(VM_LONG(arg[0]), VM_POINTER(arg[1]), 7);
break;
case G_SETORIGIN:
{
edict_t *e = Q1QVMPF_EdictNum(svprogfuncs, arg[0]);
edict_t *e = Q1QVMPF_EdictNum(svprogfuncs, VM_LONG(arg[0]));
if (!e || e->isfree)
return false;
@ -653,11 +660,17 @@ static int syscallqvm (void *offset, unsigned int mask, int fn, const int *arg)
break;
case G_CENTERPRINT:
WrapQCBuiltin(PF_centerprint, offset, mask, arg, "ns");
PF_centerprint_Internal(VM_LONG(arg[0]), VM_POINTER(arg[1]));
break;
case G_AMBIENTSOUND:
WrapQCBuiltin(PF_ambientsound, offset, mask, arg, "vsff");
{
vec3_t pos;
pos[0] = VM_FLOAT(arg[0]);
pos[1] = VM_FLOAT(arg[1]);
pos[2] = VM_FLOAT(arg[2]);
PF_ambientsound_Internal(pos, VM_POINTER(arg[3]), VM_FLOAT(arg[4]), VM_FLOAT(arg[5]));
}
break;
case G_SOUND:
@ -689,20 +702,36 @@ static int syscallqvm (void *offset, unsigned int mask, int fn, const int *arg)
break;
case G_LOCALCMD:
WrapQCBuiltin(PF_localcmd, offset, mask, arg, "s");
Cbuf_AddText (VM_POINTER(arg[0]), RESTRICT_INSECURE);
break;
case G_CVAR:
{
int i;
cvar_t *c;
c = Cvar_Get(VM_POINTER(arg[0]), "", 0, "Gamecode");
char *vname = VM_POINTER(arg[0]);
//paused state is not a cvar.
if (!strcmp(vname, "sv_paused"))
{
float f;
f = sv.paused;
return VM_LONG(f);
}
c = Cvar_Get(vname, "", 0, "Gamecode");
i = VM_LONG(c->value);
return i;
}
case G_CVAR_SET:
WrapQCBuiltin(PF_cvar_set, offset, mask, arg, "ss");
{
cvar_t *var;
var = Cvar_Get(VM_POINTER(arg[0]), VM_POINTER(arg[1]), 0, "Gamecode variables");
if (!var)
return -1;
Cvar_Set (var, VM_POINTER(arg[1]));
}
break;
case G_FINDRADIUS:
@ -720,7 +749,7 @@ static int syscallqvm (void *offset, unsigned int mask, int fn, const int *arg)
continue;
VectorSubtract(ed->v->origin, org, diff);
if (rad > DotProduct(diff, diff))
return (int)(vevars + start*pr_edict_size);
return (qintptr_t)(vevars + start*pr_edict_size);
}
return 0;
}
@ -863,7 +892,7 @@ static int syscallqvm (void *offset, unsigned int mask, int fn, const int *arg)
WrapQCBuiltin(PF_WriteCoord, offset, mask, arg, "if");
break;
case G_WRITESTRING:
WrapQCBuiltin(PF_WriteString, offset, mask, arg, "is");
PF_WriteString_Internal(VM_LONG(arg[0]), VM_POINTER(arg[1]));
break;
case G_WRITEENTITY:
WrapQCBuiltin(PF_WriteEntity, offset, mask, arg, "in");
@ -970,10 +999,15 @@ static int syscallqvm (void *offset, unsigned int mask, int fn, const int *arg)
if (VM_OOB(arg[2], arg[3]))
return 0;
return VM_GetFileList(VM_POINTER(arg[0]), VM_POINTER(arg[1]), VM_POINTER(arg[2]), VM_LONG(arg[3]));
break;
case G_CVAR_SET_FLOAT:
WrapQCBuiltin(PF_cvar_setf, offset, mask, arg, "sf");
{
cvar_t *var;
var = Cvar_Get(VM_POINTER(arg[0]), VM_POINTER(arg[1]), 0, "Gamecode variables");
if (!var)
return -1;
Cvar_SetValue (var, VM_FLOAT(arg[1]));
}
break;
case G_CVAR_STRING:
@ -1186,13 +1220,37 @@ Con_DPrintf("PF_readcmd: %s\n%s", s, output);
while (start < sv.allocated_client_slots)
{
if (svs.clients[start].state == cs_spawned)
return (int)(vevars + (start+1) * pr_edict_size);
return (qintptr_t)(vevars + (start+1) * pr_edict_size);
start++;
}
return 0;
}
break;
case G_SETPAUSE:
{
int i;
client_t *cl;
int pause = VM_LONG(arg[0]);
if ((sv.paused&1) == (pause&1))
break; //nothing changed, ignore it.
sv.paused = pause;
sv.pausedstart = Sys_DoubleTime();
// send out notifications
for (i=0, cl = svs.clients ; i<MAX_CLIENTS ; i++, cl++)
{
if (!cl->state)
continue;
if ((ISQWCLIENT(cl) || ISNQCLIENT(cl)) && !cl->controller)
{
ClientReliableWrite_Begin (cl, svc_setpause, 2);
ClientReliableWrite_Byte (cl, sv.paused);
}
}
}
break;
default:
SV_Error("Q1QVM: Trap %i not implemented\n", fn);
break;
@ -1200,28 +1258,41 @@ Con_DPrintf("PF_readcmd: %s\n%s", s, output);
return 0;
}
static int EXPORT_FN syscallnative (int arg, ...)
#if __WORDSIZE == 64
static int syscallqvm (void *offset, unsigned qintptr_t mask, int fn, const int *arg)
{
int args[13];
qintptr_t args[13];
int i;
for (i = 0; i < 13; i++)
args[i] = arg[i];
return syscallhandle(offset, mask, fn, args);
}
#else
#define syscallqvm syscallhandle
#endif
static qintptr_t EXPORT_FN syscallnative (qintptr_t arg, ...)
{
qintptr_t args[13];
va_list argptr;
va_start(argptr, arg);
args[0]=va_arg(argptr, int);
args[1]=va_arg(argptr, int);
args[2]=va_arg(argptr, int);
args[3]=va_arg(argptr, int);
args[4]=va_arg(argptr, int);
args[5]=va_arg(argptr, int);
args[6]=va_arg(argptr, int);
args[7]=va_arg(argptr, int);
args[8]=va_arg(argptr, int);
args[9]=va_arg(argptr, int);
args[10]=va_arg(argptr, int);
args[11]=va_arg(argptr, int);
args[12]=va_arg(argptr, int);
args[0]=va_arg(argptr, qintptr_t);
args[1]=va_arg(argptr, qintptr_t);
args[2]=va_arg(argptr, qintptr_t);
args[3]=va_arg(argptr, qintptr_t);
args[4]=va_arg(argptr, qintptr_t);
args[5]=va_arg(argptr, qintptr_t);
args[6]=va_arg(argptr, qintptr_t);
args[7]=va_arg(argptr, qintptr_t);
args[8]=va_arg(argptr, qintptr_t);
args[9]=va_arg(argptr, qintptr_t);
args[10]=va_arg(argptr, qintptr_t);
args[11]=va_arg(argptr, qintptr_t);
args[12]=va_arg(argptr, qintptr_t);
va_end(argptr);
return syscallqvm(NULL, ~0, arg, args);
return syscallhandle(NULL, ~0, arg, args);
}
void Q1QVM_Shutdown(void)
@ -1250,7 +1321,7 @@ qboolean PR_LoadQ1QVM(void)
int i;
gameDataN_t *gd, gdm;
gameData32_t *gd32;
int ret;
qintptr_t ret;
if (q1qvm)
VM_Destroy(q1qvm);
@ -1288,25 +1359,33 @@ qboolean PR_LoadQ1QVM(void)
q1qvmprogfuncs.stringtable = VM_MemoryBase(q1qvm);
ret = VM_Call(q1qvm, GAME_INIT, (int)(sv.time*1000), rand());
ret = VM_Call(q1qvm, GAME_INIT, (qintptr_t)(sv.time*1000), rand());
if (!ret)
{
Q1QVM_Shutdown();
return false;
}
if (VM_NonNative(q1qvm))
{
gd32 = (gameData32_t*)((char*)VM_MemoryBase(q1qvm) + ret); //qvm is 32bit
//when running native64, we need to convert these to real types, so we can use em below
//double casts to silence warnings
gd = &gdm;
gd->ents = (struct edict_s *)gd32->ents;
gd->ents = (struct vmedict_s *)(qintptr_t)gd32->ents;
gd->sizeofent = gd32->sizeofent;
gd->global = (q1qvmglobalvars_t *)gd32->global;
gd->fields = (field_t *)gd32->fields;
gd->global = (q1qvmglobalvars_t *)(qintptr_t)gd32->global;
gd->fields = (field_t *)(qintptr_t)gd32->fields;
gd->APIversion = gd32->APIversion;
}
else
{
gd = (gameDataN_t*)((char*)VM_MemoryBase(q1qvm) + ret); //qvm is 32bit
}
pr_edict_size = gd->sizeofent;
vevars = (long)gd->ents;
vevars = (qintptr_t)gd->ents;
evars = ((char*)VM_MemoryBase(q1qvm) + vevars);
//FIXME: range check this pointer
//FIXME: range check the globals pointer
@ -1316,11 +1395,11 @@ qboolean PR_LoadQ1QVM(void)
//WARNING: global is not remapped yet...
//This code is written evilly, but works well enough
#define globalint(required, name) pr_nqglobal_struct->name = (int*)((char*)VM_MemoryBase(q1qvm)+(long)&gd->global->name) //the logic of this is somewhat crazy
#define globalfloat(required, name) pr_nqglobal_struct->name = (float*)((char*)VM_MemoryBase(q1qvm)+(long)&gd->global->name)
#define globalstring(required, name) pr_nqglobal_struct->name = (string_t*)((char*)VM_MemoryBase(q1qvm)+(long)&gd->global->name)
#define globalvec(required, name) pr_nqglobal_struct->V_##name = (vec3_t*)((char*)VM_MemoryBase(q1qvm)+(long)&gd->global->name)
#define globalfunc(required, name) pr_nqglobal_struct->name = (int*)((char*)VM_MemoryBase(q1qvm)+(long)&gd->global->name)
#define globalint(required, name) pr_nqglobal_struct->name = (int*)((char*)VM_MemoryBase(q1qvm)+(qintptr_t)&gd->global->name) //the logic of this is somewhat crazy
#define globalfloat(required, name) pr_nqglobal_struct->name = (float*)((char*)VM_MemoryBase(q1qvm)+(qintptr_t)&gd->global->name)
#define globalstring(required, name) pr_nqglobal_struct->name = (string_t*)((char*)VM_MemoryBase(q1qvm)+(qintptr_t)&gd->global->name)
#define globalvec(required, name) pr_nqglobal_struct->V_##name = (vec3_t*)((char*)VM_MemoryBase(q1qvm)+(qintptr_t)&gd->global->name)
#define globalfunc(required, name) pr_nqglobal_struct->name = (int*)((char*)VM_MemoryBase(q1qvm)+(qintptr_t)&gd->global->name)
globalint (true, self); //we need the qw ones, but any in standard quake and not quakeworld, we don't really care about.
globalint (true, other);
globalint (true, world);
@ -1368,13 +1447,12 @@ qboolean PR_LoadQ1QVM(void)
pr_nqglobal_struct->trace_endcontents = &writable;
for (i = 0; i < 16; i++)
spawnparamglobals[i] = (float*)((char*)VM_MemoryBase(q1qvm)+(long)(&gd->global->parm1 + i));
spawnparamglobals[i] = (float*)((char*)VM_MemoryBase(q1qvm)+(qintptr_t)(&gd->global->parm1 + i));
for (; i < NUM_SPAWN_PARMS; i++)
spawnparamglobals[i] = NULL;
sv.edicts = EDICT_NUM(svprogfuncs, 0);
return true;
}
@ -1465,7 +1543,7 @@ void Q1QVM_PostThink(void)
void Q1QVM_StartFrame(void)
{
VM_Call(q1qvm, GAME_START_FRAME, (int)(sv.time*1000));
VM_Call(q1qvm, GAME_START_FRAME, (qintptr_t)(sv.time*1000));
}
void Q1QVM_Touch(void)
@ -1498,6 +1576,11 @@ void Q1QVM_ClientCommand(void)
VM_Call(q1qvm, GAME_CLIENT_COMMAND);
}
void Q1QVM_GameCodePausedTic(float pausedduration)
{
VM_Call(q1qvm, GAME_PAUSED_TIC, (qintptr_t)(pausedduration*1000));
}
void Q1QVM_DropClient(client_t *cl)
{
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, cl->edict);

View file

@ -145,6 +145,7 @@ void Q1QVM_Blocked(void);
void Q1QVM_SetNewParms(void);
void Q1QVM_SetChangeParms(void);
void Q1QVM_ClientCommand(void);
void Q1QVM_GameCodePausedTic(float pausedduration);
void Q1QVM_DropClient(struct client_s *cl);
void Q1QVM_ChainMoved(void);
void Q1QVM_EndFrame(void);

View file

@ -505,6 +505,7 @@ typedef struct client_s
SCP_QUAKEWORLD,
SCP_QUAKE2,
SCP_QUAKE3,
//all the below are considered netquake clients.
SCP_NETQUAKE,
SCP_DARKPLACES6,
SCP_DARKPLACES7 //extra prediction stuff
@ -684,18 +685,14 @@ typedef struct
} challenge_t;
typedef struct bannedips_s {
enum {BAN_BAN, BAN_FILTER, BAN_PERMIT} type;
struct bannedips_s *next;
netadr_t adr;
netadr_t adrmask;
unsigned int expiretime;
char reason[1];
} bannedips_t;
typedef struct filteredip_s {
struct filteredip_s *next;
netadr_t adr;
netadr_t adrmask;
} filteredips_t;
typedef enum {
GT_PROGS, //q1, qw, h2 are similar enough that we consider it only one game mode. (We don't support the h2 protocol)
GT_Q1QVM,
@ -750,7 +747,6 @@ typedef struct
challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting
bannedips_t *bannedips;
filteredips_t *filteredips;
char progsnames[MAX_PROGS][32];
progsnum_t progsnum[MAX_PROGS];

View file

@ -833,7 +833,7 @@ void SV_FilterIP_f (void)
netadr_t banmask;
int i;
client_t *cl;
filteredips_t *nb;
bannedips_t *nb;
extern cvar_t filterban;
if (Cmd_Argc() < 2)
@ -865,11 +865,13 @@ void SV_FilterIP_f (void)
}
// add IP and mask to filter list
nb = Z_Malloc(sizeof(filteredips_t));
nb->next = svs.filteredips;
nb = Z_Malloc(sizeof(bannedips_t));
nb->next = svs.bannedips;
nb->adr = banadr;
nb->adrmask = banmask;
svs.filteredips = nb;
nb->type = BAN_FILTER;
*nb->reason = 0;
svs.bannedips = nb;
}
void SV_BanList_f (void)
@ -894,7 +896,7 @@ void SV_BanList_f (void)
void SV_FilterList_f (void)
{
int filtercount = 0;
filteredips_t *nb = svs.filteredips;
bannedips_t *nb = svs.bannedips;
char adr[MAX_ADR_SIZE];
while (nb)
@ -952,8 +954,8 @@ void SV_Unban_f (void)
void SV_Unfilter_f (void)
{
qboolean all = false;
filteredips_t *nb = svs.filteredips;
filteredips_t *nbnext;
bannedips_t *nb = svs.bannedips;
bannedips_t *nbnext;
netadr_t unbanadr = {0};
netadr_t unbanmask = {0};
char adr[MAX_ADR_SIZE];
@ -979,8 +981,8 @@ void SV_Unfilter_f (void)
{
if (!all)
Con_Printf("unfiltered %s\n", NET_AdrToStringMasked(adr, sizeof(adr), nb->adr, nb->adrmask));
if (svs.filteredips == nb)
svs.filteredips = nbnext;
if (svs.bannedips == nb)
svs.bannedips = nbnext;
Z_Free(nb);
break;
}
@ -994,7 +996,6 @@ void SV_WriteIP_f (void)
vfsfile_t *f;
char name[MAX_OSPATH];
bannedips_t *bi;
filteredips_t *fi;
char *s;
char adr[MAX_ADR_SIZE];
@ -1009,31 +1010,21 @@ void SV_WriteIP_f (void)
return;
}
s = "// banned ip addresses\n";
VFS_WRITE(f, s, strlen(s));
bi = svs.bannedips;
while (bi)
{
if (bi->reason[0])
s = va("banip %s \"%s\"\n", NET_AdrToStringMasked(adr, sizeof(adr), bi->adr, bi->adrmask), bi->reason);
if (bi->type == BAN_BAN)
s = "banip";
else
s = va("banip %s\n", NET_AdrToStringMasked(adr, sizeof(adr), bi->adr, bi->adrmask));
s = "addip";
if (bi->reason[0])
s = va("%s %s \"%s\"\n", s, NET_AdrToStringMasked(adr, sizeof(adr), bi->adr, bi->adrmask), bi->reason);
else
s = va("%s %s\n", s, NET_AdrToStringMasked(adr, sizeof(adr), bi->adr, bi->adrmask));
VFS_WRITE(f, s, strlen(s));
bi = bi->next;
}
s = "\n// filtered ip addresses\n";
VFS_WRITE(f, s, strlen(s));
fi = svs.filteredips;
while (fi)
{
s = va("addip %s\n", NET_AdrToStringMasked(adr, sizeof(adr), fi->adr, fi->adrmask));
VFS_WRITE(f, s, strlen(s));
fi = fi->next;
}
VFS_CLOSE (f);
}
@ -2061,8 +2052,11 @@ void SV_InitOperatorCommands (void)
Cmd_AddCommand ("fraglogfile", SV_Fraglogfile_f);
//ask clients to take a remote screenshot
Cmd_AddCommand ("snap", SV_Snap_f);
Cmd_AddCommand ("snapall", SV_SnapAll_f);
//various punishments
Cmd_AddCommand ("kick", SV_Kick_f);
Cmd_AddCommand ("mute", SV_Mute_f);
Cmd_AddCommand ("cuff", SV_Cuff_f);
@ -2083,12 +2077,6 @@ void SV_InitOperatorCommands (void)
Cmd_AddCommand ("floodprot", SV_Floodprot_f);
// Cmd_AddCommand ("filterip", SV_FilterIP_f);
// Cmd_AddCommand ("unfilter", SV_Unfilter_f);
// Cmd_AddCommand ("filterlist", SV_FilterList_f);
// Cmd_AddCommand ("writeip", SV_WriteIP_f);
Cmd_AddCommand ("sv", SV_SendGameCommand_f);
Cmd_AddCommand ("mod", SV_SendGameCommand_f);

View file

@ -73,11 +73,11 @@ sv_masterlist_t sv_masterlist[] = {
{MP_QUAKEWORLD, SCVARC("sv_master7", "", SV_Masterlist_Callback)},
{MP_QUAKEWORLD, SCVARC("sv_master8", "", SV_Masterlist_Callback)},
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra1", "master.quakeservers.net:27000", SV_Masterlist_Callback)}, //european. admin: raz0?
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra2", "asgaard.morphos-team.net:27000", SV_Masterlist_Callback)}, //admin bigfoot
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra3", "qwmaster.ocrana.de:27000", SV_Masterlist_Callback)}, //german. admin unknown
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra4", "masterserver.exhale.de:27000", SV_Masterlist_Callback)}, //german. admin unknown
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra5", "kubus.rulez.pl:27000", SV_Masterlist_Callback)}, //poland. admin unknown
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra1", "qwmaster.ocrana.de:27000", SV_Masterlist_Callback)}, //german. admin unknown
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra2", "masterserver.exhale.de:27000", SV_Masterlist_Callback)}, //german. admin unknown
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra3", "kubus.rulez.pl:27000", SV_Masterlist_Callback)}, //poland. admin unknown
{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra4", "master.quakeservers.net:27000", SV_Masterlist_Callback)}, //european. admin: raz0?
//{MP_QUAKEWORLD, SCVARC("sv_qwmasterextra5", "asgaard.morphos-team.net:27000", SV_Masterlist_Callback)}, //admin bigfoot
{MP_DARKPLACES, SCVARC("sv_masterextra1", "ghdigital.com:27950", SV_Masterlist_Callback)}, //69.59.212.88 (admin: LordHavoc)
{MP_DARKPLACES, SCVARC("sv_masterextra2", "dpmaster.deathmask.net:27950", SV_Masterlist_Callback)}, //209.164.24.243 (admin: Willis)
@ -135,7 +135,7 @@ cvar_t sv_reportheartbeats = SCVAR("sv_reportheartbeats", "1");
cvar_t sv_highchars = SCVAR("sv_highchars", "1");
cvar_t sv_loadentfiles = SCVAR("sv_loadentfiles", "1");
cvar_t sv_maxrate = SCVAR("sv_maxrate", "10000");
cvar_t sv_maxdrate = SCVAR("sv_maxdrate", "10000");
cvar_t sv_maxdrate = FCVAR("sv_maxdrate", "sv_maxdownloadrate", "10000", 0);
cvar_t sv_minping = SCVARF("sv_minping", "0", CVAR_SERVERINFO);
cvar_t sv_bigcoords = SCVARF("sv_bigcoords", "", CVAR_SERVERINFO);
@ -219,7 +219,7 @@ void SV_FixupName(char *in, char *out, unsigned int outlen);
void SV_AcceptClient (netadr_t adr, int userid, char *userinfo);
void Master_Shutdown (void);
void PR_SetPlayerClass(client_t *cl, int classnum, qboolean fromqc);
bannedips_t *SV_BannedAddress (netadr_t *a);
char *SV_BannedReason (netadr_t *a);
#ifdef SQL
void PR_SQLCycle();
@ -2008,11 +2008,11 @@ client_t *SVC_DirectConnect(void)
}
{
bannedips_t *banip = SV_BannedAddress(&adr);
if (banip)
char *banreason = SV_BannedReason(&adr);
if (banreason)
{
if (banip->reason[0])
SV_RejectMessage (protocol, "You were banned.\nReason: %s\n", banip->reason);
if (*banreason)
SV_RejectMessage (protocol, "You were banned.\nReason: %s\n", banreason);
else
SV_RejectMessage (protocol, "You were banned.\n");
return NULL;
@ -2386,8 +2386,8 @@ void SVC_RemoteCommand (void)
char adr[MAX_ADR_SIZE];
{
bannedips_t *banip = SV_BannedAddress(&net_from);
if (banip)
char *br = SV_BannedReason(&net_from);
if (br)
{
Con_Printf ("Rcon from banned ip %s\n", NET_AdrToString (adr, sizeof(adr), net_from));
return;
@ -2496,7 +2496,7 @@ void SVC_RealIP (void)
{
unsigned int slotnum;
int cookie;
bannedips_t *banip;
char *banreason;
char adr[MAX_ADR_SIZE];
slotnum = atoi(Cmd_Argv(1));
@ -2525,12 +2525,12 @@ void SVC_RealIP (void)
return;
}
banip = SV_BannedAddress(&net_from);
if (banip)
banreason = SV_BannedReason(&net_from);
if (banreason)
{
Con_Printf("%s has a banned realip\n", svs.clients[slotnum].name);
if (banip->reason)
SV_ClientPrintf(&svs.clients[slotnum], PRINT_CHAT, "You were banned.\nReason: %s\n", banip->reason);
if (*banreason)
SV_ClientPrintf(&svs.clients[slotnum], PRINT_CHAT, "You were banned.\nReason: %s\n", banreason);
else
SV_ClientPrintf(&svs.clients[slotnum], PRINT_CHAT, "You were banned.\n");
SV_DropClient(&svs.clients[slotnum]);
@ -2764,29 +2764,10 @@ If 0, then only addresses matching the list will be allowed. This lets you easi
cvar_t filterban = SCVAR("filterban", "1");
/*
=================
SV_FilterPacket
=================
*/
qboolean SV_FilterPacket (netadr_t *a)
{
filteredips_t *banip;
if (NET_IsLoopBackAddress(*a))
return 0; // never filter loopback
for (banip = svs.filteredips; banip; banip=banip->next)
{
if (NET_CompareAdrMasked(*a, banip->adr, banip->adrmask))
return filterban.value;
}
return !filterban.value;
}
// SV_BannedAdress, run through ban address list and return corresponding bannedips_t
// pointer, otherwise return NULL if not in the list
bannedips_t *SV_BannedAddress (netadr_t *a)
bannedips_t *SV_GetBannedAddressEntry (netadr_t *a)
{
bannedips_t *banip;
for (banip = svs.bannedips; banip; banip=banip->next)
@ -2797,6 +2778,38 @@ bannedips_t *SV_BannedAddress (netadr_t *a)
return NULL;
}
/*
=================
SV_FilterPacket
=================
*/
char *SV_BannedReason (netadr_t *a)
{
char *reason = filterban.value?NULL:""; //"" = banned with no explicit reason
bannedips_t *banip;
if (NET_IsLoopBackAddress(*a))
return NULL; // never filter loopback
for (banip = svs.bannedips; banip; banip=banip->next)
{
if (NET_CompareAdrMasked(*a, banip->adr, banip->adrmask))
{
switch(banip->type)
{
case BAN_BAN:
return banip->reason;
case BAN_PERMIT:
return 0;
default:
reason = filterban.value?banip->reason:NULL;
break;
}
}
}
return reason;
}
//send a network packet to a new non-connected client.
//this is to combat tunneling
void SV_OpenRoute_f(void)
@ -2829,6 +2842,7 @@ void SV_ReadPackets (void)
client_t *cl;
int qport;
laggedpacket_t *lp;
char *banreason;
for (i = 0; i < MAX_CLIENTS; i++) //fixme: shouldn't we be using svs.allocated_client_slots ?
{
@ -2869,8 +2883,15 @@ void SV_ReadPackets (void)
while (SV_GetPacket ())
{
if (SV_FilterPacket (&net_from))
banreason = SV_BannedReason (&net_from);
if (banreason)
{
if (*banreason)
Netchan_OutOfBandPrint(NS_SERVER, net_from, "%cYou are banned: %s\n", A2C_PRINT, banreason);
else
Netchan_OutOfBandPrint(NS_SERVER, net_from, "%cYou are banned\n", A2C_PRINT);
continue;
}
// check for connectionless packet (0xffffffff) first
if (*(int *)net_message.data == -1)
@ -3317,9 +3338,18 @@ void SV_MVDStream_Poll(void);
return;
}
else
{
#ifdef VM_Q1
if (svs.gametype == GT_Q1QVM)
{
Q1QVM_GameCodePausedTic(Sys_DoubleTime() - sv.pausedstart);
}
else
#endif
{
PR_GameCodePausedTic(Sys_DoubleTime() - sv.pausedstart);
}
}
#ifdef SQL
PR_SQLCycle();

View file

@ -3238,7 +3238,6 @@ void SVQ3_HandleClient(void)
SVQ3_ParseClientMessage(&svs.clients[i]);
}
bannedips_t *SV_BannedAddress (netadr_t *a);
void SVQ3_DirectConnect(void) //Actually connect the client, use up a slot, and let the gamecode know of it.
{
//this is only called when running q3 gamecode
@ -3248,7 +3247,6 @@ void SVQ3_DirectConnect(void) //Actually connect the client, use up a slot, and
int ret;
int challenge;
int qport;
bannedips_t *banip;
char adr[MAX_ADR_SIZE];
if (net_message.cursize < 13)
@ -3265,17 +3263,7 @@ void SVQ3_DirectConnect(void) //Actually connect the client, use up a slot, and
if (!cl)
cl = SVQ3_FindEmptyPlayerSlot();
banip = SV_BannedAddress(&net_from);
if (banip)
{
if (banip->reason[0])
reason = banip->reason;
else
reason = "Banned.";
userinfo = NULL;
}
else if (!cl)
if (!cl)
{
reason = "Server is full.";
userinfo = NULL;