saneified dynamic light colour values.

added preliminary support for some rtlight cubemaps.
no longer using tmpfile in win32 - its too unreliable.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3942 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-12-27 08:35:19 +00:00
parent 54358b62b2
commit f32a88f684
24 changed files with 458 additions and 467 deletions

View file

@ -62,22 +62,47 @@ static void VFSSTDIO_Close(vfsfile_t *file)
Z_Free(file);
}
#ifdef _WIN32
static void VFSSTDIO_CloseTemp(vfsfile_t *file)
{
vfsstdiofile_t *intfile = (vfsstdiofile_t*)file;
char *fname = (char*)(intfile+1);
fclose(intfile->handle);
_unlink(fname);
Z_Free(file);
}
#endif
vfsfile_t *FSSTDIO_OpenTemp(void)
{
FILE *f;
vfsstdiofile_t *file;
#ifdef _WIN32
/*warning: annother app might manage to open the file before we can. if the file is not opened exclusively then we can end up with issues
on windows, fopen is typically exclusive anyway, but not on unix. but on unix, tmpfile is actually usable, so special-case the windows code*/
char *fname = _tempnam(NULL, "ftemp");
f = fopen(fname, "w+b");
if (!f)
return NULL;
file = Z_Malloc(sizeof(vfsstdiofile_t) + strlen(fname)+1);
file->funcs.Close = VFSSTDIO_CloseTemp;
strcpy((char*)(file+1), fname);
free(fname);
#else
f = tmpfile();
if (!f)
return NULL;
file = Z_Malloc(sizeof(vfsstdiofile_t));
file->funcs.Close = VFSSTDIO_Close;
#endif
file->funcs.ReadBytes = VFSSTDIO_ReadBytes;
file->funcs.WriteBytes = VFSSTDIO_WriteBytes;
file->funcs.Seek = VFSSTDIO_Seek;
file->funcs.Tell = VFSSTDIO_Tell;
file->funcs.GetLen = VFSSTDIO_GetSize;
file->funcs.Close = VFSSTDIO_Close;
file->funcs.Flush = VFSSTDIO_Flush;
file->handle = f;

View file

@ -2660,6 +2660,48 @@ void QCBUILTIN PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_global
VectorCopy (newvalue, G_VECTOR(OFS_RETURN));
}
void QCBUILTIN PF_rotatevectorsbyangles (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
world_t *w = prinst->parms->user;
float *ang = G_VECTOR(OFS_PARM0);
vec3_t src[3], trans[3], res[3];
ang[0]*=-1;
AngleVectors(ang, trans[0], trans[1], trans[2]);
ang[0]*=-1;
VectorInverse(trans[1]);
VectorCopy(w->g.v_forward, src[0]);
VectorNegate(w->g.v_right, src[1]);
VectorCopy(w->g.v_up, src[2]);
R_ConcatRotations(trans, src, res);
VectorCopy(res[0], w->g.v_forward);
VectorNegate(res[1], w->g.v_right);
VectorCopy(res[2], w->g.v_up);
}
void QCBUILTIN PF_rotatevectorsbymatrix (progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
world_t *w = prinst->parms->user;
vec3_t src[3], trans[3], res[3];
VectorCopy(G_VECTOR(OFS_PARM0), src[0]);
VectorNegate(G_VECTOR(OFS_PARM1), src[1]);
VectorCopy(G_VECTOR(OFS_PARM2), src[2]);
VectorCopy(w->g.v_forward, src[0]);
VectorNegate(w->g.v_right, src[1]);
VectorCopy(w->g.v_up, src[2]);
R_ConcatRotations(trans, src, res);
VectorCopy(res[0], w->g.v_forward);
VectorNegate(res[1], w->g.v_right);
VectorCopy(res[2], w->g.v_up);
}
//Vector functions
////////////////////////////////////////////////////
//Progs internals

View file

@ -146,6 +146,8 @@ void QCBUILTIN PF_normalize (progfuncs_t *prinst, struct globalvars_s *pr_global
void QCBUILTIN PF_vlen (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vectoyaw (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_vectoangles (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rotatevectorsbyangles (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_rotatevectorsbymatrix (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchain (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void PF_findchainfloat (progfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_coredump (progfuncs_t *prinst, struct globalvars_s *pr_globals);