Misc bugfixes, including q3bsp-rtlights and bloom. Matrix use clarifications. Working towards skeletal glsl code.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3890 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-07-30 14:14:56 +00:00
parent 4dba0e3f28
commit 729d6181c2
70 changed files with 2062 additions and 1311 deletions

View file

@ -160,7 +160,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define DPMMODELS //darkplaces model format (which I've never seen anyone use)
#define PSKMODELS //PSK model format (ActorX stuff from UT, though not the format the game itself uses)
#define HALFLIFEMODELS //halflife model support (experimental)
// #define INTERQUAKEMODELS
#define INTERQUAKEMODELS
#define HUFFNETWORK //huffman network compression
//#define DOOMWADS //doom wad/sprite support
@ -444,8 +444,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_EDICTS 32767 // FIXME: ouch! ouch! ouch!
#define MAX_LIGHTSTYLES 255
#define MAX_STANDARDLIGHTSTYLES 64
#define MAX_MODELS 512 // these are sent over the net as bytes
#define MAX_SOUNDS 512 // so they cannot be blindly increased
#define MAX_MODELS 1024 // these are sent over the net as bytes
#define MAX_SOUNDS 1024 // so they cannot be blindly increased
#define MAX_VWEP_MODELS 32
#define MAX_CSQCMODELS 256 // these live entirly clientside

View file

@ -180,7 +180,7 @@ typedef struct
typedef struct
{
int planenum;
short children[2]; // negative numbers are contents
int children[2]; // negative numbers are contents
} mclipnode_t;
typedef struct texinfo_s

File diff suppressed because it is too large Load diff

View file

@ -7,8 +7,6 @@
#include <stdlib.h>
#endif
#define MAX_BONES 256
int HLMod_BoneForName(model_t *mod, char *name);
int HLMod_FrameForName(model_t *mod, char *name);
@ -23,8 +21,8 @@ typedef struct {
int ofsskins;
#endif
qboolean sharesverts; //used with models with two shaders using the same vertex - use last mesh's verts
qboolean sharesbones; //use last mesh's bones (please, never set this on the first mesh!)
int shares_verts; //used with models with two shaders using the same vertex. set to the surface number to inherit from (or itself).
int shares_bones; //use last mesh's bones. set to the surface number to inherit from (or itself).
int numverts;
@ -41,8 +39,15 @@ typedef struct {
#ifdef SKELETALMODELS
int numbones;
int ofsbones;
int numtransforms;
int ofstransforms;
int numswtransforms;
int ofsswtransforms;
int ofs_skel_xyz;
int ofs_skel_norm;
int ofs_skel_svect;
int ofs_skel_tvect;
int ofs_skel_idx;
int ofs_skel_weight;
#endif
//these exist only in the root mesh.
@ -122,9 +127,8 @@ float *Alias_GetBonePositions(galiasinfo_t *inf, framestate_t *fstate, float *bu
#ifdef SKELETALMODELS
void Alias_TransformVerticies(float *bonepose, galisskeletaltransforms_t *weights, int numweights, vecV_t *xyzout, vec3_t *normout);
#endif
qboolean Alias_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf,
entity_t *e,
float alpha, qboolean nolightdir);
qboolean Alias_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int surfnum, entity_t *e, qboolean allowskel);
void Alias_FlushCache(void);
void Mod_DoCRC(model_t *mod, char *buffer, int buffersize);

View file

@ -1405,9 +1405,9 @@ static void World_Physics_Frame_BodyToEntity(world_t *world, wedict_t *ed)
up[2] = r[10];
VectorCopy(vel, velocity);
VectorCopy(avel, spinvelocity);
Matrix4Q_FromVectors(bodymatrix, forward, left, up, origin);
Matrix4x4_RM_FromVectors(bodymatrix, forward, left, up, origin);
Matrix4_Multiply(ed->ode.ode_offsetimatrix, bodymatrix, entitymatrix);
Matrix4Q_ToVectors(entitymatrix, forward, left, up, origin);
Matrix3x4_RM_ToVectors(entitymatrix, forward, left, up, origin);
VectorAngles(forward, up, angles);
angles[0]*=-1;
@ -1847,7 +1847,7 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
switch(solid)
{
case SOLID_BSP:
Matrix4_Identity(ed->ode.ode_offsetmatrix);
Matrix4x4_Identity(ed->ode.ode_offsetmatrix);
ed->ode.ode_geom = NULL;
if (!model)
{
@ -1863,7 +1863,7 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
return;
}
Matrix4Q_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
Matrix4x4_RM_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
// now create the geom
dataID = dGeomTriMeshDataCreate();
dGeomTriMeshDataBuildSingle(dataID, (void*)ed->ode.ode_vertex3f, sizeof(float[3]), ed->ode.ode_numvertices, ed->ode.ode_element3i, ed->ode.ode_numtriangles*3, sizeof(int[3]));
@ -1874,12 +1874,12 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
case SOLID_SLIDEBOX:
case SOLID_CORPSE:
case SOLID_PHYSICS_BOX:
Matrix4Q_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
Matrix4x4_RM_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
ed->ode.ode_geom = (void *)dCreateBox(world->ode.ode_space, geomsize[0], geomsize[1], geomsize[2]);
dMassSetBoxTotal(&mass, massval, geomsize[0], geomsize[1], geomsize[2]);
break;
case SOLID_PHYSICS_SPHERE:
Matrix4Q_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
Matrix4x4_RM_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
ed->ode.ode_geom = (void *)dCreateSphere(world->ode.ode_space, geomsize[0] * 0.5f);
dMassSetSphereTotal(&mass, massval, geomsize[0] * 0.5f);
break;
@ -1895,11 +1895,11 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
// transform to it
memset(capsulerot, 0, sizeof(capsulerot));
if (axisindex == 0)
Matrix4_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 0, 0, 90, 1);
Matrix4x4_CM_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 0, 0, 90, 1);
else if (axisindex == 1)
Matrix4_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 90, 0, 0, 1);
Matrix4x4_CM_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 90, 0, 0, 1);
else
Matrix4_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 0, 0, 0, 1);
Matrix4x4_CM_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 0, 0, 0, 1);
radius = geomsize[!axisindex] * 0.5f; // any other axis is the radius
length = geomsize[axisindex] - radius*2;
// because we want to support more than one axisindex, we have to
@ -1911,7 +1911,7 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
default:
Sys_Error("World_Physics_BodyFromEntity: unrecognized solid value %i was accepted by filter\n", solid);
}
Matrix4Q_Invert_Simple(ed->ode.ode_offsetmatrix, ed->ode.ode_offsetimatrix);
Matrix3x4_InvertTo4x4_Simple(ed->ode.ode_offsetmatrix, ed->ode.ode_offsetimatrix);
ed->ode.ode_massbuf = BZ_Malloc(sizeof(dMass));
memcpy(ed->ode.ode_massbuf, &mass, sizeof(dMass));
}
@ -2065,9 +2065,9 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
VectorCopy(avelocity, ed->ode.ode_avelocity);
ed->ode.ode_gravity = gravity;
Matrix4Q_FromVectors(entitymatrix, forward, left, up, origin);
Matrix4x4_RM_FromVectors(entitymatrix, forward, left, up, origin);
Matrix4_Multiply(ed->ode.ode_offsetmatrix, entitymatrix, bodymatrix);
Matrix4Q_ToVectors(bodymatrix, forward, left, up, origin);
Matrix3x4_RM_ToVectors(bodymatrix, forward, left, up, origin);
r[0][0] = forward[0];
r[1][0] = forward[1];
r[2][0] = forward[2];

View file

@ -92,7 +92,8 @@ cvar_t registered = CVARD("registered","0","Set if quake's pak1.pak is available
cvar_t gameversion = CVARFD("gameversion","", CVAR_SERVERINFO, "gamecode version for server browsers");
cvar_t gameversion_min = CVARD("gameversion_min","", "gamecode version for server browsers");
cvar_t gameversion_max = CVARD("gameversion_max","", "gamecode version for server browsers");
cvar_t com_gamename = CVARD("com_gamename", "", "The game name used for dpmaster queries");
cvar_t fs_gamename = CVARFD("fs_gamename", "", CVAR_NOSET, "The filesystem is trying to run this game");
cvar_t com_protocolname = CVARD("com_gamename", "", "The game name used for dpmaster queries");
cvar_t com_modname = CVARD("com_modname", "", "dpmaster information");
cvar_t com_parseutf8 = CVARD("com_parseutf8", "0", "Interpret console messages/playernames/etc as UTF-8. Requires special fonts."); //1 parse. 2 parse, but stop parsing that string if a char was malformed.

View file

@ -432,6 +432,7 @@ void Info_SetValueForStarKey (char *s, const char *key, const char *value, int m
void Info_Print (char *s);
void Info_WriteToFile(vfsfile_t *f, char *info, char *commandname, int cvarflags);
void Com_BlocksChecksum (int blocks, void **buffer, int *len, unsigned char *outbuf);
unsigned int Com_BlockChecksum (void *buffer, int length);
void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf);
qbyte COM_BlockSequenceCheckByte (qbyte *base, int length, int sequence, unsigned mapchecksum);

View file

@ -659,8 +659,8 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
#ifndef CLIENTONLY
if (var->flags & CVAR_SERVERINFO)
{
char *old = Info_ValueForKey(svs.info, var->name);
if (strcmp(old, value)) //only spam the server if it actually changed
// char *old = Info_ValueForKey(svs.info, var->name);
// if (strcmp(old, value)) //only spam the server if it actually changed
{
Info_SetValueForKey (svs.info, var->name, value, MAX_SERVERINFO_STRING);
SV_SendServerInfoChange(var->name, value);

View file

@ -1665,7 +1665,9 @@ const gamemode_info_t gamemode_info[] = {
{"Darkplaces-Rogue", "rogue", "-rogue", {NULL}, NULL, {"id1", "qw", "rogue", "fte"}, "Quake: Dissolution of Eternity"},
{"Nexuiz", "nexuiz", "-nexuiz", {"nexuiz.exe"}, NEXCFG, {"data", "ftedata"}, "Nexuiz"},
{"Xonotic", "xonotic", "-xonotic", {"xonotic.exe"}, NEXCFG, {"data", "ftedata"}, "Xonotic"},
{"DMF", "dmf", "-dmf", {"base/src/progs.src"}, DMFCFG, {"base", }, "DMF"},
{"DMF", "dmf", "-dmf", {"base/src/progs.src",
"base/qwprogs.dat",
"base/pak0.pak"}, DMFCFG, {"base", }, "DMF"},
//supported commercial mods (some are currently only partially supported)
{"FTE-H2MP", "h2mp", "-portals", {"portals/hexen.rc",
@ -1673,12 +1675,14 @@ const gamemode_info_t gamemode_info[] = {
{"FTE-Hexen2", "hexen2", "-hexen2", {"data1/pak0.pak"}, HEX2CFG,{"data1", "fteh2"}, "Hexen II"},
{"FTE-Quake2", "q2", "-q2", {"baseq2/pak0.pak"}, NULL, {"baseq2", "fteq2"}, "Quake II"},
{"FTE-Quake3", "q3", "-q3", {"baseq3/pak0.pk3"}, Q3CFG, {"baseq3", "fteq3"}, "Quake III Arena"},
//the rest are not officially supported.
{"FTE-Quake4", "q4", "-q4", {"q4base/pak00.pk4"}, NULL, {"q4base", "fteq4"}, "Quake 4"},
{"FTE-EnemyTerritory", "et", "-et", {"etmain/pak0.pk3"}, NULL, {"etmain", "fteet"}, "Wolfenstein - Enemy Territory"},
{"FTE-JK2", "jk2", "-jk2", {"base/assets0.pk3"}, NULL, {"base", "fte"}, "Jedi Knight II: Jedi Outcast"},
{"FTE-HalfLife", "hl", "-halflife", {"valve/liblist.gam"} ,NULL, {"valve", "ftehl"}, "Half-Life"},
{"FTE-HalfLife", "hl", "-halflife", {"valve/liblist.gam"}, NULL, {"valve", "ftehl"}, "Half-Life"},
{NULL}
};
@ -2145,7 +2149,8 @@ void FS_StartupWithGame(int gamenum)
LibZ_Init();
#endif
Cvar_Set(&com_gamename, gamemode_info[gamenum].protocolname);
Cvar_Set(&com_protocolname, gamemode_info[gamenum].protocolname);
Cvar_ForceSet(&fs_gamename, gamemode_info[gamenum].poshname);
//
// start up with id1 by default
@ -2258,8 +2263,9 @@ void COM_InitFilesystem (void)
Cvar_Register(&com_gamename, "evil hacks");
Cvar_Register(&com_modname, "evil hacks");
Cvar_Register(&fs_gamename, "FS");
Cvar_Register(&com_protocolname, "Server Info");
Cvar_Register(&com_modname, "Server Info");
//identify the game from a telling file
for (i = 0; gamemode_info[i].argname && gamenum==-1; i++)
{

View file

@ -2230,7 +2230,7 @@ qboolean CModQ3_LoadFaces (lump_t *l)
out->patch_cp[1] = LittleLong ( in->patchheight );
}
loadmodel->numsurfaces = i;\
loadmodel->numsurfaces = i;
return true;
}
@ -2507,9 +2507,7 @@ qboolean CModQ3_LoadRFaces (lump_t *l)
out->light_t = LittleLong(in->lightmap_y);
out->extents[0] = (LittleLong(in->lightmap_width)-1)<<4;
out->extents[1] = (LittleLong(in->lightmap_height)-1)<<4;
out->samples = loadmodel->lightdata + 3*(out->light_s + out->light_t*128 + out->lightmaptexturenum*128*128);
if (out->lightmaptexturenum<0)
out->samples=NULL;
out->samples=NULL;
fv = LittleLong(in->firstvertex);
{
@ -2628,8 +2626,8 @@ qboolean CModQ3_LoadRFaces (lump_t *l)
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[2]);
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[3]);
}
if (out->mesh->numindexes == 0)
Con_Printf("foo\n");
if (out->mesh->numindexes == 0)
Con_Printf("foo\n");
}
Mod_NormaliseTextureVectors(map_normals_array, map_svector_array, map_tvector_array, numvertexes);
@ -2677,9 +2675,7 @@ qboolean CModRBSP_LoadRFaces (lump_t *l)
out->light_t = in->lightmap_offs[0][0];
out->extents[0] = (in->lightmap_width-1)<<4;
out->extents[1] = (in->lightmap_height-1)<<4;
out->samples = loadmodel->lightdata + 3*(out->light_s + out->light_t*128 + out->lightmaptexturenum*128*128);
if (out->lightmaptexturenum<0)
out->samples=NULL;
out->samples=NULL;
fv = LittleLong(in->firstvertex);
{

View file

@ -844,7 +844,7 @@ void QuaternionSlerp( const vec4_t p, vec4_t q, float t, vec4_t qt )
#endif
//This function is GL stylie (use as 2nd arg to ML_MultMatrix4).
float *Matrix4_NewRotation(float a, float x, float y, float z)
float *Matrix4x4_CM_NewRotation(float a, float x, float y, float z)
{
static float ret[16];
float c = cos(a* M_PI / 180.0);
@ -873,7 +873,7 @@ float *Matrix4_NewRotation(float a, float x, float y, float z)
}
//This function is GL stylie (use as 2nd arg to ML_MultMatrix4).
float *Matrix4_NewTranslation(float x, float y, float z)
float *Matrix4x4_CM_NewTranslation(float x, float y, float z)
{
static float ret[16];
ret[0] = 1;
@ -923,7 +923,7 @@ void Matrix4_Multiply(const float *a, const float *b, float *out)
}
//transform 4d vector by a 4d matrix.
void Matrix4_Transform4(const float *matrix, const float *vector, float *product)
void Matrix4x4_CM_Transform4(const float *matrix, const float *vector, float *product)
{
product[0] = matrix[0]*vector[0] + matrix[4]*vector[1] + matrix[8]*vector[2] + matrix[12]*vector[3];
product[1] = matrix[1]*vector[0] + matrix[5]*vector[1] + matrix[9]*vector[2] + matrix[13]*vector[3];
@ -931,14 +931,14 @@ void Matrix4_Transform4(const float *matrix, const float *vector, float *product
product[3] = matrix[3]*vector[0] + matrix[7]*vector[1] + matrix[11]*vector[2] + matrix[15]*vector[3];
}
void Matrix4_Transform3(const float *matrix, const float *vector, float *product)
void Matrix4x4_CM_Transform3(const float *matrix, const float *vector, float *product)
{
product[0] = matrix[0]*vector[0] + matrix[4]*vector[1] + matrix[8]*vector[2] + matrix[12];
product[1] = matrix[1]*vector[0] + matrix[5]*vector[1] + matrix[9]*vector[2] + matrix[13];
product[2] = matrix[2]*vector[0] + matrix[6]*vector[1] + matrix[10]*vector[2] + matrix[14];
}
void Matrix4_ModelViewMatrix(float *modelview, const vec3_t viewangles, const vec3_t vieworg)
void Matrix4x4_CM_ModelViewMatrix(float *modelview, const vec3_t viewangles, const vec3_t vieworg)
{
float tempmat[16];
//load identity.
@ -949,8 +949,8 @@ void Matrix4_ModelViewMatrix(float *modelview, const vec3_t viewangles, const ve
modelview[10] = 1;
modelview[15] = 1;
Matrix4_Multiply(modelview, Matrix4_NewRotation(-90, 1, 0, 0), tempmat); // put Z going up
Matrix4_Multiply(tempmat, Matrix4_NewRotation(90, 0, 0, 1), modelview); // put Z going up
Matrix4_Multiply(modelview, Matrix4_CM_NewRotation(-90, 1, 0, 0), tempmat); // put Z going up
Matrix4_Multiply(tempmat, Matrix4_CM_NewRotation(90, 0, 0, 1), modelview); // put Z going up
#else
//use this lame wierd and crazy identity matrix..
modelview[2] = -1;
@ -961,19 +961,37 @@ void Matrix4_ModelViewMatrix(float *modelview, const vec3_t viewangles, const ve
//figure out the current modelview matrix
//I would if some of these, but then I'd still need a couple of copys
Matrix4_Multiply(modelview, Matrix4_NewRotation(-viewangles[2], 1, 0, 0), tempmat);
Matrix4_Multiply(tempmat, Matrix4_NewRotation(-viewangles[0], 0, 1, 0), modelview);
Matrix4_Multiply(modelview, Matrix4_NewRotation(-viewangles[1], 0, 0, 1), tempmat);
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-viewangles[2], 1, 0, 0), tempmat);
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewRotation(-viewangles[0], 0, 1, 0), modelview);
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-viewangles[1], 0, 0, 1), tempmat);
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
}
void Matrix4_CreateTranslate (float *out, float x, float y, float z)
void Matrix4x4_CM_CreateTranslate (float *out, float x, float y, float z)
{
memcpy(out, Matrix4_NewTranslation(x, y, z), 16*sizeof(float));
out[0] = 1;
out[1] = 0;
out[2] = 0;
out[3] = 0;
out[4] = 0;
out[5] = 1;
out[6] = 0;
out[7] = 0;
out[8] = 0;
out[9] = 0;
out[10] = 1;
out[11] = 0;
out[12] = x;
out[13] = y;
out[14] = z;
out[15] = 1;
}
void Matrix4Q_CreateTranslate (float *out, float x, float y, float z)
void Matrix4x4_RM_CreateTranslate (float *out, float x, float y, float z)
{
out[0] = 1;
out[4] = 0;
@ -996,7 +1014,7 @@ void Matrix4Q_CreateTranslate (float *out, float x, float y, float z)
out[15] = 1;
}
void Matrix4_ModelViewMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg)
void Matrix4x4_CM_ModelViewMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg)
{
float tempmat[16];
@ -1017,11 +1035,11 @@ void Matrix4_ModelViewMatrixFromAxis(float *modelview, const vec3_t pn, const ve
tempmat[14] = 0;
tempmat[15] = 1;
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
}
void Matrix4Q_ToVectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3])
void Matrix3x4_RM_ToVectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3])
{
vx[0] = in[0];
vx[1] = in[4];
@ -1040,7 +1058,7 @@ void Matrix4Q_ToVectors(const float *in, float vx[3], float vy[3], float vz[3],
t [2] = in[11];
}
void Matrix4Q_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
void Matrix4x4_RM_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
{
out[0] = vx[0];
out[1] = vy[0];
@ -1060,7 +1078,23 @@ void Matrix4Q_FromVectors(float *out, const float vx[3], const float vy[3], cons
out[15] = 1.0f;
}
void Matrix4_ModelMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg)
void Matrix3x4_RM_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
{
out[0] = vx[0];
out[1] = vy[0];
out[2] = vz[0];
out[3] = t[0];
out[4] = vx[1];
out[5] = vy[1];
out[6] = vz[1];
out[7] = t[1];
out[8] = vx[2];
out[9] = vy[2];
out[10] = vz[2];
out[11] = t[2];
}
void Matrix4x4_CM_ModelMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg)
{
float tempmat[16];
@ -1081,10 +1115,10 @@ void Matrix4_ModelMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t
tempmat[14] = 0;
tempmat[15] = 1;
Matrix4_Multiply(Matrix4_NewTranslation(vieworg[0], vieworg[1], vieworg[2]), tempmat, modelview); // put Z going up
Matrix4_Multiply(Matrix4x4_CM_NewTranslation(vieworg[0], vieworg[1], vieworg[2]), tempmat, modelview); // put Z going up
}
void Matrix4_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitch, vec_t yaw, vec_t roll, vec_t scale)
void Matrix4x4_CM_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitch, vec_t yaw, vec_t roll, vec_t scale)
{
float tempmat[16];
//load identity.
@ -1095,8 +1129,8 @@ void Matrix4_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitc
modelview[10] = 1;
modelview[15] = 1;
Matrix4_Multiply(modelview, Matrix4_NewRotation(-90, 1, 0, 0), tempmat); // put Z going up
Matrix4_Multiply(tempmat, Matrix4_NewRotation(90, 0, 0, 1), modelview); // put Z going up
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-90, 1, 0, 0), tempmat); // put Z going up
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewRotation(90, 0, 0, 1), modelview); // put Z going up
#else
//use this lame wierd and crazy identity matrix..
modelview[2] = -1;
@ -1107,14 +1141,14 @@ void Matrix4_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitc
//figure out the current modelview matrix
//I would if some of these, but then I'd still need a couple of copys
Matrix4_Multiply(modelview, Matrix4_NewRotation(-roll, 1, 0, 0), tempmat);
Matrix4_Multiply(tempmat, Matrix4_NewRotation(-pitch, 0, 1, 0), modelview);
Matrix4_Multiply(modelview, Matrix4_NewRotation(-yaw, 0, 0, 1), tempmat);
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-roll, 1, 0, 0), tempmat);
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewRotation(-pitch, 0, 1, 0), modelview);
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-yaw, 0, 0, 1), tempmat);
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(x, y, z), modelview);
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewTranslation(x, y, z), modelview);
}
void Matrix4_Identity(float *outm)
void Matrix4x4_Identity(float *outm)
{
outm[ 0] = 1;
outm[ 1] = 0;
@ -1134,7 +1168,7 @@ void Matrix4_Identity(float *outm)
outm[15] = 1;
}
void Matrix4_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard)
void Matrix4x4_CM_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard)
{
double xmin, xmax, ymin, ymax;
@ -1174,7 +1208,7 @@ void Matrix4_Projection_Far(float *proj, float fovx, float fovy, float neard, fl
proj[15] = 0;
}
void Matrix4_Projection_Inf(float *proj, float fovx, float fovy, float neard)
void Matrix4x4_CM_Projection_Inf(float *proj, float fovx, float fovy, float neard)
{
float xmin, xmax, ymin, ymax;
float nudge = 1;
@ -1214,7 +1248,7 @@ void Matrix4_Projection_Inf(float *proj, float fovx, float fovy, float neard)
proj[11] = -1;
proj[15] = 0;
}
void Matrix4_Projection2(float *proj, float fovx, float fovy, float neard)
void Matrix4x4_CM_Projection2(float *proj, float fovx, float fovy, float neard)
{
float xmin, xmax, ymin, ymax;
float nudge = 1;
@ -1247,7 +1281,7 @@ void Matrix4_Projection2(float *proj, float fovx, float fovy, float neard)
proj[15] = 0;
}
void Matrix4_Orthographic(float *proj, float xmin, float xmax, float ymin, float ymax,
void Matrix4x4_CM_Orthographic(float *proj, float xmin, float xmax, float ymin, float ymax,
float znear, float zfar)
{
proj[0] = 2/(xmax-xmin);
@ -1270,7 +1304,7 @@ void Matrix4_Orthographic(float *proj, float xmin, float xmax, float ymin, float
proj[11] = 0;
proj[15] = 1;
}
void Matrix4_OrthographicD3D(float *proj, float xmin, float xmax, float ymax, float ymin,
void Matrix4x4_CM_OrthographicD3D(float *proj, float xmin, float xmax, float ymax, float ymin,
float znear, float zfar)
{
proj[0] = 2/(xmax-xmin);
@ -1472,7 +1506,7 @@ qboolean Matrix4_Invert(const float *m, float *out)
#undef SWAP_ROWS
}
void Matrix3_Invert_Simple (const vec3_t in1[3], vec3_t out[3])
void Matrix3x3_RM_Invert_Simple (const vec3_t in1[3], vec3_t out[3])
{
// we only support uniform scaling, so assume the first row is enough
// (note the lack of sqrt here, because we're trying to undo the scaling,
@ -1503,7 +1537,7 @@ void Matrix3_Invert_Simple (const vec3_t in1[3], vec3_t out[3])
out[2][2] = in1[2][2] * scale;
}
void Matrix4Q_Invert_Simple (const float *in1, float *out)
void Matrix3x4_Invert_Simple (const float *in1, float *out)
{
// we only support uniform scaling, so assume the first row is enough
// (note the lack of sqrt here, because we're trying to undo the scaling,
@ -1531,29 +1565,19 @@ void Matrix4Q_Invert_Simple (const float *in1, float *out)
out[9] = in1[6] * scale;
out[10] = in1[10] * scale;
#ifdef MATRIX4x4_OPENGLORIENTATION
// invert the translate
out->m[12] = -(in1[12] * out[0] + in1[13] * out[4] + in1[14] * out[8]);
out->m[13] = -(in1[12] * out[1] + in1[13] * out[5] + in1[14] * out[9]);
out->m[14] = -(in1[12] * out[2] + in1[13] * out[6] + in1[14] * out[10]);
// don't know if there's anything worth doing here
out[3] = 0;
out[7] = 0;
out[11] = 0;
out[15] = 1;
#else
// invert the translate
out[3] = -(in1[3] * out[0] + in1[7] * out[1] + in1[11] * out[2]);
out[7] = -(in1[3] * out[4] + in1[7] * out[5] + in1[11] * out[6]);
out[11] = -(in1[3] * out[8] + in1[7] * out[9] + in1[11] * out[10]);
}
// don't know if there's anything worth doing here
void Matrix3x4_InvertTo4x4_Simple (const float *in1, float *out)
{
Matrix3x4_Invert_Simple(in1, out);
out[12] = 0;
out[13] = 0;
out[14] = 0;
out[15] = 1;
#endif
}
void Matrix3x4_InvertTo3x3(float *in, float *result)
@ -1590,14 +1614,14 @@ void Matrix3x4_InvertTo3x3(float *in, float *result)
//screen->3d
void Matrix4_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy)
void Matrix4x4_CM_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy)
{
float modelview[16];
float proj[16];
float tempm[16];
Matrix4_ModelViewMatrix(modelview, viewangles, vieworg);
Matrix4_Projection_Inf(proj, fovx, fovy, 4);
Matrix4x4_CM_ModelViewMatrix(modelview, viewangles, vieworg);
Matrix4x4_CM_Projection_Inf(proj, fovx, fovy, 4);
Matrix4_Multiply(proj, modelview, tempm);
Matrix4_Invert(tempm, proj);
@ -1613,7 +1637,7 @@ void Matrix4_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, con
if (v[2] >= 1)
v[2] = 0.999999;
Matrix4_Transform4(proj, v, tempv);
Matrix4x4_CM_Transform4(proj, v, tempv);
out[0] = tempv[0]/tempv[3];
out[1] = tempv[1]/tempv[3];
@ -1624,13 +1648,13 @@ void Matrix4_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, con
//returns fractions of screen.
//uses GL style rotations and translations and stuff.
//3d -> screen (fixme: offscreen return values needed)
void Matrix4_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy)
void Matrix4x4_CM_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy)
{
float modelview[16];
float proj[16];
Matrix4_ModelViewMatrix(modelview, viewangles, vieworg);
Matrix4_Projection_Inf(proj, fovx, fovy, 4);
Matrix4x4_CM_ModelViewMatrix(modelview, viewangles, vieworg);
Matrix4x4_CM_Projection_Inf(proj, fovx, fovy, 4);
{
float v[4], tempv[4];
@ -1639,8 +1663,8 @@ void Matrix4_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, cons
v[2] = in[2];
v[3] = 1;
Matrix4_Transform4(modelview, v, tempv);
Matrix4_Transform4(proj, tempv, v);
Matrix4x4_CM_Transform4(modelview, v, tempv);
Matrix4x4_CM_Transform4(proj, tempv, v);
v[0] /= v[3];
v[1] /= v[3];

View file

@ -129,34 +129,46 @@ vec_t Length (vec3_t v);
void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up);
float Q_rsqrt(float number);
//used for crosshair stuff.
/*
_CM means column major.
_RM means row major
Note that openGL is column-major.
Logical C code uses row-major.
mat3x4 is always row-major (and functions can accept many RM mat4x4)
*/
void Matrix3_Multiply (vec3_t *in1, vec3_t *in2, vec3_t *out);
void Matrix4_Identity(float *outm);
void Matrix4x4_Identity(float *outm);
qboolean Matrix4_Invert(const float *m, float *out);
void Matrix4Q_Invert_Simple (const float *in1, float *out);
void Matrix3_Invert_Simple(const vec3_t in[3], vec3_t out[3]);
void Matrix4_CreateTranslate (float *out, float x, float y, float z);
void Matrix4Q_CreateTranslate (float *out, float x, float y, float z);
void Matrix4_ModelMatrixFromAxis (float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg);
void Matrix4_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitch, vec_t yaw, vec_t roll, vec_t scale);
void Matrix4_ModelViewMatrix (float *modelview, const vec3_t viewangles, const vec3_t vieworg);
void Matrix4_ModelViewMatrixFromAxis (float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg);
void Matrix3x4_Invert_Simple (const float *in1, float *out);
void Matrix3x4_InvertTo4x4_Simple (const float *in1, float *out);
void Matrix3x3_RM_Invert_Simple(const vec3_t in[3], vec3_t out[3]);
void Matrix4x4_RM_CreateTranslate (float *out, float x, float y, float z);
void Matrix4x4_CM_CreateTranslate (float *out, float x, float y, float z);
void Matrix4x4_CM_ModelMatrixFromAxis (float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg);
void Matrix4x4_CM_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitch, vec_t yaw, vec_t roll, vec_t scale);
void Matrix4x4_CM_ModelViewMatrix (float *modelview, const vec3_t viewangles, const vec3_t vieworg);
void Matrix4x4_CM_ModelViewMatrixFromAxis (float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg);
void Matrix4_CreateFromQuakeEntity (float *matrix, float x, float y, float z, float pitch, float yaw, float roll, float scale);
void Matrix4_Multiply (const float *a, const float *b, float *out);
void Matrix4_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy);
void Matrix4_Transform3 (const float *matrix, const float *vector, float *product);
void Matrix4_Transform4 (const float *matrix, const float *vector, float *product);
void Matrix4_UnProject (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy);
void Matrix4Q_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3]);
void Matrix4Q_ToVectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3]);
void Matrix4x4_CM_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy);
void Matrix4x4_CM_Transform3 (const float *matrix, const float *vector, float *product);
void Matrix4x4_CM_Transform4 (const float *matrix, const float *vector, float *product);
void Matrix4x4_CM_UnProject (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy);
void Matrix3x4_RM_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3]);
void Matrix4x4_RM_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3]);
void Matrix3x4_RM_ToVectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3]);
float *Matrix4x4_CM_NewRotation(float a, float x, float y, float z);
float *Matrix4x4_CM_NewTranslation(float x, float y, float z);
#define AngleVectorsFLU(a,f,l,u) do{AngleVectors(a,f,l,u);VectorNegate(l,l);}while(0)
//projection matricies of different types... gesh
void Matrix4_Orthographic (float *proj, float xmin, float xmax, float ymax, float ymin, float znear, float zfar);
void Matrix4_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard);
void Matrix4_Projection2 (float *proj, float fovx, float fovy, float neard);
void Matrix4_Projection_Inf(float *proj, float fovx, float fovy, float neard);
void Matrix4x4_CM_Orthographic (float *proj, float xmin, float xmax, float ymax, float ymin, float znear, float zfar);
void Matrix4x4_CM_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard);
void Matrix4x4_CM_Projection2 (float *proj, float fovx, float fovy, float neard);
void Matrix4x4_CM_Projection_Inf(float *proj, float fovx, float fovy, float neard);
fixed16_t Mul16_30 (fixed16_t multiplier, fixed16_t multiplicand);
int Q_log2 (int val);

View file

@ -300,3 +300,16 @@ void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf)
MD4Update (&ctx, (unsigned char *)buffer, len);
MD4Final ( outbuf, &ctx);
}
void Com_BlocksChecksum (int blocks, void **buffer, int *len, unsigned char *outbuf)
{
MD4_CTX ctx;
MD4Init (&ctx);
while(blocks --> 0)
{
MD4Update (&ctx, (unsigned char *)*buffer++, *len++);
}
MD4Final (outbuf, &ctx);
}

View file

@ -99,6 +99,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PROTOCOL_VERSION_HUFFMAN (('H'<<0) + ('U'<<8) + ('F'<<16) + ('F' << 24)) //packet compression
#define PROTOCOL_VERSION_VARLENGTH (('v'<<0) + ('l'<<8) + ('e'<<16) + ('n' << 24)) //packet compression
#define PROTOCOL_INFO_GUID (('G'<<0) + ('U'<<8) + ('I'<<16) + ('D' << 24)) //globally 'unique' client id info.
#define PROTOCOL_VERSION_QW 28
#define PROTOCOL_VERSION_Q2_MIN 31
#define PROTOCOL_VERSION_Q2 34

View file

@ -444,7 +444,7 @@ qboolean Q1BSP_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3]
{
vec3_t iaxis[3];
vec3_t norm;
Matrix3_Invert_Simple((void *)axis, iaxis);
Matrix3x3_RM_Invert_Simple((void *)axis, iaxis);
VectorCopy(trace->plane.normal, norm);
trace->plane.normal[0] = DotProduct(norm, iaxis[0]);
trace->plane.normal[1] = DotProduct(norm, iaxis[1]);

View file

@ -1061,6 +1061,16 @@ void *VM_MemoryBase(vm_t *vm)
return NULL;
}
}
quintptr_t VM_MemoryMask(vm_t *vm)
{
switch(vm->type)
{
case VM_BYTECODE:
return ((qvm_t*)vm->hInst)->ds_mask;
default:
return ~(quintptr_t)0;
}
}
/*returns true if we're running a 32bit vm on a 64bit host (in case we need workarounds)*/
qboolean VM_NonNative(vm_t *vm)

View file

@ -63,6 +63,7 @@ qboolean LibPNG_Init(void);
unsigned int Sys_Milliseconds (void);
double Sys_DoubleTime (void);
qboolean Sys_RandomBytes(qbyte *string, int len);
char *Sys_ConsoleInput (void);

View file

@ -65,7 +65,7 @@
"STL_VOTE \"%s casts a vote for '%s'\\n\"\n"
"STL_SPEEDCHEATKICKED \"%s was kicked for speedcheating (%s)\\n\"\n"
"STL_SPEEDCHEATPOSSIBLE \"Speed cheat possibility, analyzing:\\n %d %.1f %d for: %s\\n\"\n"
"STL_INITED \"======== QuakeWorld Initialized ========\\n\"\n"
"STL_INITED \"======== %s Initialized ========\\n\"\n"
"STL_BACKBUFSET \"WARNING %s: [SV_New] Back buffered (%d0, clearing)\\n\"\n"
"STL_MESSAGEOVERFLOW \"WARNING: backbuf [%d] reliable overflow for %s\\n\"\n"
"STL_BUILDINGPHS \"Building PHS...\\n\"\n"

View file

@ -74,7 +74,7 @@ static char *defaultlanguagetext =
"STL_VOTE \"%s casts a vote for '%s'\\n\"\n"
"STL_SPEEDCHEATKICKED \"%s was kicked for speedcheating (%s)\\n\"\n"
"STL_SPEEDCHEATPOSSIBLE \"Speed cheat possibility, analyzing:\\n %d %.1f %d for: %s\\n\"\n"
"STL_INITED \"======== FTE QuakeWorld Initialized ========\\n\"\n"
"STL_INITED \"======== %s Initialized ========\\n\"\n"
"STL_BACKBUFSET \"WARNING %s: [SV_New] Back buffered (%d0, clearing)\\n\"\n"
"STL_MESSAGEOVERFLOW \"WARNING: backbuf [%d] reliable overflow for %s\\n\"\n"
"STL_BUILDINGPHS \"Building PHS...\\n\"\n"
@ -230,7 +230,7 @@ static char *defaultlanguagetext =
"TLC_HOSTFATALERROR \"Host_Error: %s\\n\"\n"
"TLC_CONFIGCFG_WRITEFAILED \"Couldn't write config.cfg.\\n\"\n"
"TLC_HOSTSPEEDSOUTPUT \"%3i tot %3i server %3i gfx %3i snd\\n\"\n"
"TLC_QUAKEWORLD_INITED \"^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081 QuakeWorld Initialized ^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082\\n\"\n"
"TLC_QUAKEWORLD_INITED \"^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081 %s Initialized ^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082\\n\"\n"
"TLC_DEDICATEDCANNOTCONNECT \"Connect ignored - dedicated. set a renderer first\\n\"\n"
"TLC_Q2CONLESSPACKET_UNKNOWN \"unknown connectionless packet for q2: %s\\n\"\n"
"TL_NORELATIVEPATHS \"Refusing to download a path with ..\\n\"\n"

View file

@ -59,6 +59,7 @@ qboolean VM_Restart(vm_t *vm);
qintptr_t VARGS VM_Call(vm_t *vm, qintptr_t instruction, ...);
qboolean VM_NonNative(vm_t *vm);
void *VM_MemoryBase(vm_t *vm);
quintptr_t VM_MemoryMask(vm_t *vm);

View file

@ -91,7 +91,7 @@ typedef struct q2trace_s
#define MOVE_HITMODEL 4
#define MOVE_RESERVED 8 //so we are less likly to get into tricky situations when we want to steal annother future DP extension.
#define MOVE_TRIGGERS 16 //triggers must be marked with FINDABLE_NONSOLID (an alternative to solid-corpse)
#define MOVE_EVERYTHING 32 //doesn't use the area grid stuff, and can return triggers and non-solid items if they're marked with FINDABLE_NONSOLID
#define MOVE_EVERYTHING 32 //can return triggers and non-solid items if they're marked with FINDABLE_NONSOLID (works even if the items are not properly linked)
#define MOVE_LAGGED 64 //trace touches current last-known-state, instead of actual ents (just affects players for now)
typedef struct areanode_s