From 8dc7815228deac3963fe6fcc5b9769ecb84286ee Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 17 Nov 2004 18:13:33 +0000 Subject: [PATCH] changes angles->axis and stuff git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@467 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/gl/gl_alias.c | 41 +++++++++++++++++++++++++++++++++-------- engine/gl/gl_draw.c | 16 ++++++++++------ engine/gl/gl_draw.h | 1 + engine/gl/gl_model.h | 1 + engine/gl/gl_ppl.c | 1 + engine/gl/gl_rlight.c | 18 ++++++++++++------ engine/gl/gl_rmain.c | 29 ++++++++++++++++++++++++++++- engine/gl/gl_rmisc.c | 2 ++ engine/gl/gl_rsurf.c | 2 +- 9 files changed, 89 insertions(+), 22 deletions(-) diff --git a/engine/gl/gl_alias.c b/engine/gl/gl_alias.c index c059dae4b..a7c3eb51e 100644 --- a/engine/gl/gl_alias.c +++ b/engine/gl/gl_alias.c @@ -78,6 +78,10 @@ typedef struct { int groupofs; int nextsurf; + + + int numtags; + int ofstags; } galiasinfo_t; //frame is an index into this @@ -2316,11 +2320,35 @@ void GL_LoadQ2Model (model_t *mod, void *buffer) +typedef struct { + char name[MAX_QPATH]; + vec3_t org; + float ang[3][3]; +} md3tag_t; +void Mod_GetTag(model_t *model, int tagnum, int frame, float **org, float **axis) +{ + galiasinfo_t *inf; + md3tag_t *t; + *org = NULL; + *axis = NULL; + if (!model || model->type != mod_alias) + return; + + inf = Mod_Extradata(model); + t = (md3tag_t*)((char*)inf + inf->ofstags); + if (tagnum <= 0 || tagnum > inf->numtags) + return; + tagnum--; //tagnum 0 is 'use my angles/org' + + t += tagnum; + *org = t->org; + *axis = (float*)t->ang; +} @@ -2404,13 +2432,6 @@ typedef struct { } md3Shader_t; //End of Tenebrae 'assistance' -typedef struct { - char name[MAX_QPATH]; - vec3_t org; - float ang[3][3]; -} md3tag_t; - - void GL_LoadQ3Model(model_t *mod, void *buffer) { extern qboolean gl_bumpmappingpossible; @@ -2644,9 +2665,13 @@ void GL_LoadQ3Model(model_t *mod, void *buffer) surf = (md3Surface_t *)((qbyte *)surf + surf->ofsEnd); } + root->numtags = header->numTags; + root->ofstags = (char*)Hunk_Alloc(header->numTags*sizeof(md3tag_t)*header->numFrames) - (char*)root; + memcpy((char*)root+root->ofstags, (char*)header+header->ofsTags, header->numTags*sizeof(md3tag_t)*header->numFrames); + // // move the complete, relocatable alias model to the cache -// +// hunkend = Hunk_LowMark (); diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index 6a7e3890f..142681b43 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -727,7 +727,10 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n")); if (!draw_chars) //or low res. { if (!(char_texture=Mod_LoadHiResTexture("pics/conchars.pcx", false, true, false))) //try low res q2 path + if (!(char_texture=Mod_LoadHiResTexture("gfx/2d/bigchars.tga", false, true, false))) //try low res q2 path { + + //gulp... so it's come to this has it? rework the hexen2 conchars into the q1 system. char *tempchars = COM_LoadMallocFile("gfx/menu/conchars.lmp"); char *in, *out; if (!tempchars) @@ -951,7 +954,8 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n")); { if (!(gl->texnum=Mod_LoadHiResTexture("pics/conback.pcx", false, true, false))) if (!(gl->texnum=Mod_LoadReplacementTexture("gfx/menu/conback.lmp", false, true, false))) - Sys_Error ("Couldn't load gfx/conback.lmp"); //that's messed it up, hasn't it?... + if (!(gl->texnum=Mod_LoadReplacementTexture("textures/sfx/logo512.jpg", false, false, false))) + Sys_Error ("Couldn't load gfx/conback.lmp"); //that's messed it up, hasn't it?... } else { @@ -1342,7 +1346,7 @@ void GLDraw_Pic (int x, int y, qpic_t *pic) #endif } -void GLDraw_LevelPic (qpic_t *pic) //Fullscreen and stuff +void GLDraw_ScalePic (int x, int y, int width, int height, qpic_t *pic) { glpic_t *gl; @@ -1356,13 +1360,13 @@ void GLDraw_LevelPic (qpic_t *pic) //Fullscreen and stuff GL_Bind (gl->texnum); glBegin (GL_QUADS); glTexCoord2f (gl->sl, gl->tl); - glVertex2f (0, 0); + glVertex2f (x, y); glTexCoord2f (gl->sh, gl->tl); - glVertex2f (vid.conwidth, 0); + glVertex2f (x+width, y); glTexCoord2f (gl->sh, gl->th); - glVertex2f (vid.conwidth, vid.conheight); + glVertex2f (x+width, y+height); glTexCoord2f (gl->sl, gl->th); - glVertex2f (0, vid.conheight); + glVertex2f (x, y+height); glEnd (); } diff --git a/engine/gl/gl_draw.h b/engine/gl/gl_draw.h index 7c9c69cdc..cf8206ffc 100644 --- a/engine/gl/gl_draw.h +++ b/engine/gl/gl_draw.h @@ -30,6 +30,7 @@ void GLDraw_ColouredCharacter (int x, int y, unsigned int num); void GLDraw_DebugChar (qbyte num); void GLDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int height); void GLDraw_Pic (int x, int y, qpic_t *pic); +void GLDraw_ScalePic (int x, int y, int width, int height, qpic_t *pic); void GLDraw_TransPic (int x, int y, qpic_t *pic); void GLDraw_TransPicTranslate (int x, int y, qpic_t *pic, qbyte *translation); void GLDraw_ConsoleBackground (int lines); diff --git a/engine/gl/gl_model.h b/engine/gl/gl_model.h index 93cf724d7..7c5449a21 100644 --- a/engine/gl/gl_model.h +++ b/engine/gl/gl_model.h @@ -69,6 +69,7 @@ typedef struct mesh_s unsigned int patchWidth; unsigned int patchHeight; } mesh_t; +struct meshbuffer_s; void R_PushMesh ( mesh_t *mesh, int features ); void R_RenderMeshBuffer ( struct meshbuffer_s *mb, qboolean shadowpass ); diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index 22fff496c..4647842f6 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -1277,6 +1277,7 @@ static void PPL_BaseTextureChain(msurface_t *first) s->ownerent = &r_worldentity; continue; } + if (s->mesh) { redraw = mb.fog != s->fog || mb.infokey != vi|| mb.shader->flags&SHADER_DEFORMV_BULGE; diff --git a/engine/gl/gl_rlight.c b/engine/gl/gl_rlight.c index 4e9629a2c..f07546975 100644 --- a/engine/gl/gl_rlight.c +++ b/engine/gl/gl_rlight.c @@ -414,13 +414,19 @@ void GLQ3_LightGrid(vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t // if (!lg) { - res_ambient[0] = 64; - res_ambient[1] = 64; - res_ambient[2] = 64; + if(res_ambient) + { + res_ambient[0] = 64; + res_ambient[1] = 64; + res_ambient[2] = 64; + } - res_diffuse[0] = 192; - res_diffuse[1] = 192; - res_diffuse[2] = 192; + if (res_diffuse) + { + res_diffuse[0] = 192; + res_diffuse[1] = 192; + res_diffuse[2] = 192; + } return; } diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index cbd5496a9..cc70b4e40 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -172,12 +172,39 @@ qboolean R_CullSphere (vec3_t org, float radius) void R_RotateForEntity (entity_t *e) { - glTranslatef (e->origin[0], e->origin[1], e->origin[2]); + float m[16]; + m[0] = e->axis[0][0]; + m[1] = e->axis[0][1]; + m[2] = e->axis[0][2]; + m[3] = 0; + m[4] = e->axis[1][0]; + m[5] = e->axis[1][1]; + m[6] = e->axis[1][2]; + m[7] = 0; + + m[8] = e->axis[2][0]; + m[9] = e->axis[2][1]; + m[10] = e->axis[2][2]; + m[11] = 0; + + m[12] = e->origin[0]; + m[13] = e->origin[1]; + m[14] = e->origin[2]; + m[15] = 1; + + + +#if 1 + glMultMatrixf(m); + +#else + glTranslatef (e->origin[0], e->origin[1], e->origin[2]); glRotatef (e->angles[1], 0, 0, 1); glRotatef (-e->angles[0], 0, 1, 0); //ZOID: fixed z angle glRotatef (e->angles[2], 1, 0, 0); +#endif } /* diff --git a/engine/gl/gl_rmisc.c b/engine/gl/gl_rmisc.c index f73b26075..0a02d5323 100644 --- a/engine/gl/gl_rmisc.c +++ b/engine/gl/gl_rmisc.c @@ -852,6 +852,8 @@ void GLR_NewMap (void) d_lightstylevalue[i] = 264; // normal light value memset (&r_worldentity, 0, sizeof(r_worldentity)); + AngleVectors(r_worldentity.angles, r_worldentity.axis[0], r_worldentity.axis[1], r_worldentity.axis[2]); + VectorInverse(r_worldentity.axis[1]); r_worldentity.model = cl.worldmodel; Cvar_Set(&host_mapname, cl.worldmodel->name); diff --git a/engine/gl/gl_rsurf.c b/engine/gl/gl_rsurf.c index c85a5be0d..162170e07 100644 --- a/engine/gl/gl_rsurf.c +++ b/engine/gl/gl_rsurf.c @@ -1977,7 +1977,7 @@ void R_RenderDynamicLightmaps (msurface_t *fa) // lightmap[fa->lightmaptexturenum]->polys = fa->polys; // check for lightmap modification - if (cl.worldmodel->fromgame != fg_quake3) //no lightstyles on q3 maps +// if (cl.worldmodel->fromgame != fg_quake3) //no lightstyles on q3 maps { for (maps = 0 ; maps < MAXLIGHTMAPS && fa->styles[maps] != 255 ; maps++)