From af61bec22f837210d6dee20b486587c81f1128a8 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Mon, 9 Apr 2007 09:38:46 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@945 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/entities.cpp | 8 ++-- source/src/hudgun.cpp | 2 +- source/src/md2.h | 12 ++--- source/src/md3.h | 16 +++---- source/src/menus.cpp | 11 +++-- source/src/rendercubes.cpp | 86 +++++++++++++++++----------------- source/src/rendergl.cpp | 42 +++++++++-------- source/src/rendermodel.cpp | 10 ++-- source/src/renderparticles.cpp | 22 ++++----- source/src/vertmodel.h | 12 ++--- source/src/weapon.cpp | 2 +- 11 files changed, 113 insertions(+), 110 deletions(-) diff --git a/source/src/entities.cpp b/source/src/entities.cpp index f9127b14..be9f5fa5 100644 --- a/source/src/entities.cpp +++ b/source/src/entities.cpp @@ -20,7 +20,7 @@ char *entmdlnames[] = void renderent(entity &e, char *mdlname, float z, float yaw, int anim = ANIM_MAPMODEL|ANIM_LOOP, int basetime = 0, float speed = 10.0f) { - rendermodel(mdlname, anim, 0, 1.1f, e.x, z+S(e.x, e.y)->floor, e.y, yaw, 0, speed, basetime); + rendermodel(mdlname, anim, 0, 1.1f, e.x, e.y, z+S(e.x, e.y)->floor, yaw, 0, speed, basetime); } void renderentities() @@ -39,7 +39,7 @@ void renderentities() { mapmodelinfo &mmi = getmminfo(e.attr2); if(!&mmi) continue; - rendermodel(mmi.name, ANIM_MAPMODEL|ANIM_LOOP, e.attr4, mmi.rad ? (float)mmi.rad : 1.1f, e.x, (float)S(e.x, e.y)->floor+mmi.zoff+e.attr3, e.y, (float)((e.attr1+7)-(e.attr1+7)%15), 0, 10.0f); + rendermodel(mmi.name, ANIM_MAPMODEL|ANIM_LOOP, e.attr4, mmi.rad ? (float)mmi.rad : 1.1f, e.x, e.y, (float)S(e.x, e.y)->floor+mmi.zoff+e.attr3, (float)((e.attr1+7)-(e.attr1+7)%15), 0, 10.0f); } else if(m_ctf && e.type==CTF_FLAG) { @@ -48,12 +48,12 @@ void renderentities() { if(!f.actor || f.actor == player1) continue; s_sprintfd(path)("pickups/flags/small_%s", team_string(e.attr2)); - rendermodel(path, ANIM_FLAG|ANIM_START, 0, 1.1f, f.actor->o.x, f.actor->o.z+0.3f+(sinf(lastmillis/100.0f)+1)/10, f.actor->o.y, lastmillis/2.5f, 0, 120.0f); + rendermodel(path, ANIM_FLAG|ANIM_START, 0, 1.1f, f.actor->o.x, f.actor->o.y, f.actor->o.z+0.3f+(sinf(lastmillis/100.0f)+1)/10, lastmillis/2.5f, 0, 120.0f); } else { s_sprintfd(path)("pickups/flags/%s", team_string(e.attr2)); - rendermodel(path, ANIM_FLAG|ANIM_LOOP, 0, 4, e.x, f.state==CTFF_INBASE ? (float)S(e.x, e.y)->floor : e.z, e.y, (float)((e.attr1+7)-(e.attr1+7)%15), 0, 120.0f); + rendermodel(path, ANIM_FLAG|ANIM_LOOP, 0, 4, e.x, e.y, f.state==CTFF_INBASE ? (float)S(e.x, e.y)->floor : e.z, (float)((e.attr1+7)-(e.attr1+7)%15), 0, 120.0f); } } else if(isitem(e.type)) diff --git a/source/src/hudgun.cpp b/source/src/hudgun.cpp index ce21aaed..839c1a22 100644 --- a/source/src/hudgun.cpp +++ b/source/src/hudgun.cpp @@ -114,7 +114,7 @@ void renderhudgun(int gun, int lastaction, int index = 0) lastanim[index] = wm.anim|(gun<<16); lastswitch[index] = lastmillis; } - rendermodel(path, wm.anim|(index ? ANIM_MIRROR : 0), 0, 0, wm.pos.x, wm.pos.z, wm.pos.y, player1->yaw + 90, player1->pitch+wm.k_rot, 40.0f, lastswitch[index], NULL, NULL, 1.28f); + rendermodel(path, wm.anim|(index ? ANIM_MIRROR : 0), 0, 0, wm.pos.x, wm.pos.y, wm.pos.z, player1->yaw+90, player1->pitch+wm.k_rot, 40.0f, lastswitch[index], NULL, NULL, 1.28f); } void renderhudgun() diff --git a/source/src/md2.h b/source/src/md2.h index 88a87671..b2143fc7 100644 --- a/source/src/md2.h +++ b/source/src/md2.h @@ -138,8 +138,8 @@ struct md2 : vertmodel md2_vertex v; fread(&v, sizeof(md2_vertex), 1, file); *curvert++ = vec(v.vertex[0]*frame.scale[0]+frame.translate[0], - v.vertex[2]*frame.scale[2]+frame.translate[2], - -(v.vertex[1]*frame.scale[1]+frame.translate[1])); + -(v.vertex[1]*frame.scale[1]+frame.translate[1]), + v.vertex[2]*frame.scale[2]+frame.translate[2]); } frame_offset += header.framesize; } @@ -172,7 +172,7 @@ struct md2 : vertmodel void begingenshadow() { - glRotatef(180, 0, -1, 0); + glRotatef(180, 0, 0, 1); } }; @@ -182,8 +182,8 @@ struct md2 : vertmodel glPushMatrix(); glTranslatef(x, y, z); - glRotatef(yaw+180, 0, -1, 0); - glRotatef(pitch, 0, 0, 1); + glRotatef(yaw+180, 0, 0, 1); + glRotatef(pitch, 0, -1, 0); if(anim&ANIM_MIRROR || scale!=1) glScalef(anim&ANIM_MIRROR ? -scale : scale, scale, scale); parts[0]->render(anim, varseed, speed, basetime, d); glPopMatrix(); @@ -229,7 +229,7 @@ struct md2 : vertmodel } delete[] pname; loadingmd2 = 0; - loopv(parts) parts[i]->scaleverts(scale/16.0f, vec(translate.x, translate.z, -translate.y)); + loopv(parts) parts[i]->scaleverts(scale/16.0f, vec(translate.x, -translate.y, translate.z)); return loaded = true; } }; diff --git a/source/src/md3.h b/source/src/md3.h index dfe0b8f2..1ccea3ce 100644 --- a/source/src/md3.h +++ b/source/src/md3.h @@ -127,7 +127,7 @@ struct md3 : vertmodel endianswap(&v, sizeof(short), 4); m.verts[j].x = v.vertex[0]/64.0f; - m.verts[j].y = v.vertex[1]/64.0f; + m.verts[j].y = -v.vertex[1]/64.0f; m.verts[j].z = v.vertex[2]/64.0f; } @@ -140,9 +140,7 @@ struct md3 : vertmodel void begingenshadow() { - glRotatef(180, 0, -1, 0); - glRotatef(-90, 0, 1, 0); - glRotatef(-90, 1, 0, 0); + glRotatef(180, 0, 0, 1); } }; @@ -158,10 +156,10 @@ struct md3 : vertmodel glPushMatrix(); glTranslatef(x, y, z); - glRotatef(yaw+180, 0, -1, 0); - glRotatef(pitch, 0, 0, 1); - glRotatef(-90, 0, 1, 0); - glRotatef(-90, 1, 0, 0); + glRotatef(yaw+180, 0, 0, 1); + glRotatef(pitch, 0, -1, 0); + glRotatef(90, 0, 0, 1); + if(anim&ANIM_MIRROR || scale!=1) glScalef(anim&ANIM_MIRROR ? -scale : scale, scale, scale); parts[0]->render(anim, varseed, speed, basetime, d); glPopMatrix(); @@ -207,7 +205,7 @@ struct md3 : vertmodel loopv(mdl.meshes) mdl.meshes[i]->skin = skin; if(skin==crosshair) conoutf("could not load model skin for %s", name1); } - loopv(parts) parts[i]->scaleverts(scale/16.0f, vec(translate.x, translate.y, translate.z)); + loopv(parts) parts[i]->scaleverts(scale/16.0f, vec(translate.x, -translate.y, translate.z)); return loaded = true; } diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 481e7a4b..c5f02aa4 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -125,10 +125,11 @@ void rendermenumdl() float t = (lastmillis-player1->lastaction)/1000.0f; if(t >= 1.6f) t = 1.6f; - glTranslatef(camera1->o.x, camera1->o.z, camera1->o.y); - glRotatef(camera1->yaw+90+180, 0, -1, 0); - glRotatef(camera1->pitch, 0, 0, 1); - + glLoadIdentity(); + glRotatef(90+180, 0, -1, 0); + glRotatef(90, -1, 0, 0); + glScalef(1, -1, 1); + bool isplayermodel = !strncmp(m.mdl, "playermodels", strlen("playermodels")); vec pos; @@ -144,7 +145,7 @@ void rendermenumdl() s_sprintfd(skin)("packages/models/%s.jpg", m.mdl); tex = -(int)textureload(skin)->id; } - rendermodel(isplayermodel ? (char *)"playermodels" : m.mdl, m.anim, tex, 0, pos.x, pos.z, pos.y, yaw, 0, 100, 0, NULL, isplayermodel ? (char*)"weapons/subgun/world" : NULL, m.scale ? m.scale/25.0f : 1.0f); + rendermodel(isplayermodel ? (char *)"playermodels" : m.mdl, m.anim, tex, 0, pos.x, pos.y, pos.z, yaw, 0, 100, 0, NULL, isplayermodel ? (char*)"weapons/subgun/world" : NULL, m.scale ? m.scale/25.0f : 1.0f); glPopMatrix(); } diff --git a/source/src/rendercubes.cpp b/source/src/rendercubes.cpp index 224678df..9158acdb 100644 --- a/source/src/rendercubes.cpp +++ b/source/src/rendercubes.cpp @@ -173,13 +173,13 @@ void render_flat(int wtex, int x, int y, int size, int h, sqr *l1, sqr *l2, sqr floorstrip = true; if(isceil) { - vert(x+size, h, y, l2, xo+xs, yo); - vert(x, h, y, l1, xo, yo); + vert(x+size, y, h, l2, xo+xs, yo); + vert(x, y, h, l1, xo, yo); } else { - vert(x, h, y, l1, xo, yo); - vert(x+size, h, y, l2, xo+xs, yo); + vert(x, y, h, l1, xo, yo); + vert(x+size, y, h, l2, xo+xs, yo); } ol3r = l1->r; ol3g = l1->g; @@ -213,13 +213,13 @@ void render_flat(int wtex, int x, int y, int size, int h, sqr *l1, sqr *l2, sqr if(isceil) { - vert(x+size, h, y+size, l3, xo+xs, yo+ys); - vert(x, h, y+size, l4, xo, yo+ys); + vert(x+size, y+size, h, l3, xo+xs, yo+ys); + vert(x, y+size, h, l4, xo, yo+ys); } else { - vert(x, h, y+size, l4, xo, yo+ys); - vert(x+size, h, y+size, l3, xo+xs, yo+ys); + vert(x, y+size, h, l4, xo, yo+ys); + vert(x+size, y+size, h, l3, xo+xs, yo+ys); } oy = y; @@ -250,13 +250,13 @@ void render_flatdelta(int wtex, int x, int y, int size, float h1, float h2, floa deltastrip = true; if(isceil) { - vert(x+size, h2, y, l2, xo+xs, yo); - vert(x, h1, y, l1, xo, yo); + vert(x+size, y, h2, l2, xo+xs, yo); + vert(x, y, h1, l1, xo, yo); } else { - vert(x, h1, y, l1, xo, yo); - vert(x+size, h2, y, l2, xo+xs, yo); + vert(x, y, h1, l1, xo, yo); + vert(x+size, y, h2, l2, xo+xs, yo); } ol3r = l1->r; ol3g = l1->g; @@ -268,13 +268,13 @@ void render_flatdelta(int wtex, int x, int y, int size, float h1, float h2, floa if(isceil) { - vert(x+size, h3, y+size, l3, xo+xs, yo+ys); - vert(x, h4, y+size, l4, xo, yo+ys); + vert(x+size, y+size, h3, l3, xo+xs, yo+ys); + vert(x, y+size, h4, l4, xo, yo+ys); } else { - vert(x, h4, y+size, l4, xo, yo+ys); - vert(x+size, h3, y+size, l3, xo+xs, yo+ys); + vert(x, y+size, h4, l4, xo, yo+ys); + vert(x+size, y+size, h3, l3, xo+xs, yo+ys); } oy = y; @@ -290,18 +290,18 @@ void render_2tris(sqr *h, sqr *s, int x1, int y1, int x2, int y2, int x3, int y3 float xf = TEXTURESCALE/sx; float yf = TEXTURESCALE/sy; - vert(x1, h->floor, y1, l1, xf*x1, yf*y1); - vert(x2, h->floor, y2, l2, xf*x2, yf*y2); - vert(x3, h->floor, y3, l3, xf*x3, yf*y3); + vert(x1, y1, h->floor, l1, xf*x1, yf*y1); + vert(x2, y2, h->floor, l2, xf*x2, yf*y2); + vert(x3, y3, h->floor, l3, xf*x3, yf*y3); addstrip(mergestrips ? GL_TRIANGLES : GL_TRIANGLE_STRIP, h->ftex, verts.length()-3, 3); lookuptexture(h->ctex, sx, sy); xf = TEXTURESCALE/sx; yf = TEXTURESCALE/sy; - vert(x3, h->ceil, y3, l3, xf*x3, yf*y3); - vert(x2, h->ceil, y2, l2, xf*x2, yf*y2); - vert(x1, h->ceil, y1, l1, xf*x1, yf*y1); + vert(x3, y3, h->ceil, l3, xf*x3, yf*y3); + vert(x2, y2, h->ceil, l2, xf*x2, yf*y2); + vert(x1, y1, h->ceil, l1, xf*x1, yf*y1); addstrip(mergestrips ? GL_TRIANGLES : GL_TRIANGLE_STRIP, h->ctex, verts.length()-3, 3); nquads++; } @@ -335,19 +335,19 @@ void render_square(int wtex, float floor1, float floor2, float ceil1, float ceil if(!flip) { - vert(x2, ceil2, y2, l2, xo+xs, -yf*ceil2); - vert(x1, ceil1, y1, l1, xo, -yf*ceil1); - if(mergestrips) vert(x1, floor1, y1, l1, xo, -floor1*yf); - vert(x2, floor2, y2, l2, xo+xs, -floor2*yf); - if(!mergestrips) vert(x1, floor1, y1, l1, xo, -floor1*yf); + vert(x2, y2, ceil2, l2, xo+xs, -yf*ceil2); + vert(x1, y1, ceil1, l1, xo, -yf*ceil1); + if(mergestrips) vert(x1, y1, floor1, l1, xo, -floor1*yf); + vert(x2, y2, floor2, l2, xo+xs, -floor2*yf); + if(!mergestrips) vert(x1, y1, floor1, l1, xo, -floor1*yf); } else { - vert(x1, ceil1, y1, l1, xo, -yf*ceil1); - vert(x2, ceil2, y2, l2, xo+xs, -yf*ceil2); - if(mergestrips) vert(x2, floor2, y2, l2, xo+xs, -floor2*yf); - vert(x1, floor1, y1, l1, xo, -floor1*yf); - if(!mergestrips) vert(x2, floor2, y2, l2, xo+xs, -floor2*yf); + vert(x1, y1, ceil1, l1, xo, -yf*ceil1); + vert(x2, y2, ceil2, l2, xo+xs, -yf*ceil2); + if(mergestrips) vert(x2, y2, floor2, l2, xo+xs, -floor2*yf); + vert(x1, y1, floor1, l1, xo, -floor1*yf); + if(!mergestrips) vert(x2, y2, floor2, l2, xo+xs, -floor2*yf); } addstrip(mergestrips ? GL_QUADS : GL_TRIANGLE_STRIP, wtex, verts.length()-4, 4); nquads++; @@ -381,12 +381,12 @@ COMMANDN(watercolour, setwatercolor, ARG_4STR); // renders water for bounding rect area that contains water... simple but very inefficient #define VERTW(vertw, body) \ - inline void vertw(int v1, float v2, int v3, float t) \ + inline void vertw(float v1, float v2, float v3, float t) \ { \ - float angle = v1*v3*0.1f + t; \ + float angle = v1*v2*0.1f + t; \ float h = 0.3f*sinf(angle); \ body; \ - glVertex3f((float)v1, v2+h, (float)v3); \ + glVertex3f(v1, v2, v3+h); \ } #define VERTWT(vertwt, body) VERTW(vertwt, { float v = cosf(angle); float duv = 0.2f*v; body; }) VERTW(vertw, {}) @@ -395,28 +395,28 @@ VERTW(vertwc, { glColor4ub(hdr.watercolor[0], hdr.watercolor[1], hdr.watercolor[2], (uchar)(hdr.watercolor[3] + (max(v, 0) - 0.5f)*51.0f)); }) VERTWT(vertwt, { - glTexCoord3f(v1+duv, v2+h, v3+duv); + glTexCoord3f(v1+duv, v2+duv, v3+h); }) VERTWT(vertwtc, { glColor4f(1, 1, 1, 0.15f + max(v, 0)*0.15f); - glTexCoord3f(v1+duv, v2+h, v3+duv); + glTexCoord3f(v1+duv, v2+duv, v3+h); }) VERTWT(vertwmtc, { glColor4f(1, 1, 1, 0.15f + max(v, 0)*0.15f); - glMultiTexCoord3f_(GL_TEXTURE0_ARB, v1+duv, v2+h, v3+duv); - glMultiTexCoord3f_(GL_TEXTURE1_ARB, v1+duv, v2+h, v3+duv); + glMultiTexCoord3f_(GL_TEXTURE0_ARB, v1+duv, v2+duv, v3+h); + glMultiTexCoord3f_(GL_TEXTURE1_ARB, v1+duv, v2+duv, v3+h); }) #define renderwaterstrips(vertw, hf, t) \ for(int x = wx1; xpitch, -1, 0, 0); glRotatef(camera1->yaw, 0, 1, 0); - glTranslatef(-camera1->o.x, -camera1->o.z, -camera1->o.y); + // move from RH to Z-up LH quake style worldspace + glRotatef(-90, 1, 0, 0); + glScalef(1, -1, 1); + + glTranslatef(-camera1->o.x, -camera1->o.y, -camera1->o.z); } void genclipmatrix(float a, float b, float c, float d, GLfloat matrix[16]) @@ -324,12 +328,12 @@ void drawreflection(float hf, int w, int h, float changelod, bool refract) transplayer(); if(!refract) { - glTranslatef(0, 2*hf, 0); - glScalef(1, -1, 1); + glTranslatef(0, 0, 2*hf); + glScalef(1, 1, -1); } GLfloat clipmat[16]; - genclipmatrix(0, refract ? -1 : 1, 0, refract ? 0.1f*reflectclip+hf : 0.1f*reflectclip-hf, clipmat); + genclipmatrix(0, 0, refract ? -1 : 1, refract ? 0.1f*reflectclip+hf : 0.1f*reflectclip-hf, clipmat); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadMatrixf(clipmat); @@ -524,8 +528,8 @@ void readmatrices() glGetIntegerv(GL_VIEWPORT, viewport); glGetDoublev(GL_MODELVIEW_MATRIX, mm); glGetDoublev(GL_PROJECTION_MATRIX, pm); - camright = vec(float(mm[0]), float(mm[8]), float(mm[4])); - camup = vec(float(mm[1]), float(mm[9]), float(mm[5])); + camright = vec(float(mm[0]), float(mm[4]), float(mm[8])); + camup = vec(float(mm[1]), float(mm[5]), float(mm[9])); } // stupid function to cater for stupid ATI linux drivers that return incorrect depth values @@ -545,7 +549,7 @@ void readdepth(int w, int h, vec &pos) { glReadPixels(w/2, h/2, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &cursordepth); double worldx = 0, worldy = 0, worldz = 0; - gluUnProject(w/2, h/2, depthcorrect(cursordepth), mm, pm, viewport, &worldx, &worldz, &worldy); + gluUnProject(w/2, h/2, depthcorrect(cursordepth), mm, pm, viewport, &worldx, &worldy, &worldz); pos.x = (float)worldx; pos.y = (float)worldy; pos.z = (float)worldz; diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 7ae5e02b..44c5b684 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -92,10 +92,10 @@ void rendermodel(char *mdl, int anim, int tex, float rad, float x, float y, floa model *m = loadmodel(mdl); if(!m) return; - if(rad > 0 && isoccluded(camera1->o.x, camera1->o.y, x-rad, z-rad, rad*2)) return; + if(rad > 0 && isoccluded(camera1->o.x, camera1->o.y, x-rad, y-rad, rad*2)) return; int ix = (int)x; - int iy = (int)z; + int iy = (int)y; vec light(1, 1, 1); int varseed = (int)(size_t)d + (d ? d->lastaction : 0); @@ -117,9 +117,9 @@ void rendermodel(char *mdl, int anim, int tex, float rad, float x, float y, floa if(dynshadow && m->hasshadows() && (!reflecting || refracting)) { - vec center(x, z, s->floor); + vec center(x, y, s->floor); if(s->type==FHF) center.z -= s->vdelta/4.0f; - if(center.z-0.1f<=y) + if(center.z-0.1f<=z) { center.z += 0.1f; glColor4f(1, 1, 1, dynshadow/100.0f); @@ -238,7 +238,7 @@ void renderclient(playerent *d, char *mdlname, char *vwepname, int tex) { anim = ANIM_ATTACK; speed = 300.0f/8; basetime = d->lastaction; } else if(!d->move && !d->strafe) { anim = ANIM_IDLE|ANIM_LOOP; } else { anim = ANIM_RUN|ANIM_LOOP; speed = 1860/d->maxspeed; } - rendermodel(mdlname, anim, tex, 1.5f, d->o.x, mz, d->o.y, d->yaw+90, d->pitch/4, speed, basetime, d, vwepname); + rendermodel(mdlname, anim, tex, 1.5f, d->o.x, d->o.y, mz, d->yaw+90, d->pitch/4, speed, basetime, d, vwepname); } extern int democlientnum; diff --git a/source/src/renderparticles.cpp b/source/src/renderparticles.cpp index 8f7a4c2b..b9ffca54 100644 --- a/source/src/renderparticles.cpp +++ b/source/src/renderparticles.cpp @@ -142,10 +142,10 @@ void render_particles(int time) switch(pt.type) { case PT_PART: - glTexCoord2i(0, 1); glVertex3f(p->o.x+(-camright.x+camup.x)*sz, p->o.z+(-camright.z+camup.z)*sz, p->o.y+(-camright.y+camup.y)*sz); - glTexCoord2i(1, 1); glVertex3f(p->o.x+( camright.x+camup.x)*sz, p->o.z+( camright.z+camup.z)*sz, p->o.y+( camright.y+camup.y)*sz); - glTexCoord2i(1, 0); glVertex3f(p->o.x+( camright.x-camup.x)*sz, p->o.z+( camright.z-camup.z)*sz, p->o.y+( camright.y-camup.y)*sz); - glTexCoord2i(0, 0); glVertex3f(p->o.x+(-camright.x-camup.x)*sz, p->o.z+(-camright.z-camup.z)*sz, p->o.y+(-camright.y-camup.y)*sz); + glTexCoord2i(0, 1); glVertex3f(p->o.x+(-camright.x+camup.x)*sz, p->o.y+(-camright.y+camup.y)*sz, p->o.z+(-camright.z+camup.z)*sz); + glTexCoord2i(1, 1); glVertex3f(p->o.x+( camright.x+camup.x)*sz, p->o.y+( camright.y+camup.y)*sz, p->o.z+( camright.z+camup.z)*sz); + glTexCoord2i(1, 0); glVertex3f(p->o.x+( camright.x-camup.x)*sz, p->o.y+( camright.y-camup.y)*sz, p->o.z+( camright.z-camup.z)*sz); + glTexCoord2i(0, 0); glVertex3f(p->o.x+(-camright.x-camup.x)*sz, p->o.y+(-camright.y-camup.y)*sz, p->o.z+(-camright.z-camup.z)*sz); xtraverts += 4; break; @@ -153,7 +153,7 @@ void render_particles(int time) sz = 1.0f + (pt.sz-1.0f)*min(p->fade, lastmillis-p->millis)/p->fade; glColor4f(pt.r, pt.g, pt.b, 1.0f-sz/pt.sz); glPushMatrix(); - glTranslatef(p->o.x, p->o.z, p->o.y); + glTranslatef(p->o.x, p->o.y, p->o.z); glRotatef(lastmillis/5.0f, 1, 1, 1); glScalef(sz, sz, sz); glCallList(1); @@ -164,8 +164,8 @@ void render_particles(int time) break; case PT_SHOTLINE: - glVertex3f(p->o.x, p->o.z, p->o.y); - glVertex3f(p->d.x, p->d.z, p->d.y); + glVertex3f(p->o.x, p->o.y, p->o.z); + glVertex3f(p->d.x, p->d.y, p->d.z); xtraverts += 2; break; @@ -175,10 +175,10 @@ void render_particles(int time) glColor4f(s->r/127.5f, s->g/127.5f, s->b/127.5, max(0, min((p->millis+p->fade - lastmillis)/1000.0f, 0.7f))); vec dx(0, 0, 0), dy(0, 0, 0); loopk(3) if(p->d[k]) { dx[(k+1)%3] = -1; dy[(k+2)%3] = p->d[k]; break; } - glTexCoord2i(0, 1); glVertex3f(p->o.x+(-dx.x+dy.x)*pt.sz, p->o.z+(-dx.z+dy.z)*pt.sz, p->o.y+(-dx.y+dy.y)*pt.sz); - glTexCoord2i(1, 1); glVertex3f(p->o.x+( dx.x+dy.x)*pt.sz, p->o.z+( dx.z+dy.z)*pt.sz, p->o.y+( dx.y+dy.y)*pt.sz); - glTexCoord2i(1, 0); glVertex3f(p->o.x+( dx.x-dy.x)*pt.sz, p->o.z+( dx.z-dy.z)*pt.sz, p->o.y+( dx.y-dy.y)*pt.sz); - glTexCoord2i(0, 0); glVertex3f(p->o.x+(-dx.x-dy.x)*pt.sz, p->o.z+(-dx.z-dy.z)*pt.sz, p->o.y+(-dx.y-dy.y)*pt.sz); + glTexCoord2i(0, 1); glVertex3f(p->o.x+(-dx.x+dy.x)*pt.sz, p->o.y+(-dx.y+dy.y)*pt.sz, p->o.z+(-dx.z+dy.z)*pt.sz); + glTexCoord2i(1, 1); glVertex3f(p->o.x+( dx.x+dy.x)*pt.sz, p->o.y+( dx.y+dy.y)*pt.sz, p->o.z+( dx.z+dy.z)*pt.sz); + glTexCoord2i(1, 0); glVertex3f(p->o.x+( dx.x-dy.x)*pt.sz, p->o.y+( dx.y-dy.y)*pt.sz, p->o.z+( dx.z-dy.z)*pt.sz); + glTexCoord2i(0, 0); glVertex3f(p->o.x+(-dx.x-dy.x)*pt.sz, p->o.y+(-dx.y-dy.y)*pt.sz, p->o.z+(-dx.z-dy.z)*pt.sz); xtraverts += 4; break; } diff --git a/source/src/vertmodel.h b/source/src/vertmodel.h index 80694b32..f5c626ec 100644 --- a/source/src/vertmodel.h +++ b/source/src/vertmodel.h @@ -434,9 +434,9 @@ struct vertmodel : model glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - glRotatef(-90, -1, 0, 0); + glScalef(1, -1, 1); - glTranslatef(0, -height, 0); + glTranslatef(0, 0, -height); begingenshadow(); loopi(numframes) genshadow(aasize, i); endgenshadow(); @@ -465,10 +465,10 @@ struct vertmodel : model float y1 = -shadowrad, y2 = shadowrad; glBegin(GL_POLYGON); - glTexCoord2f(0, 1); glVertex3f(x1*c - y1*s + o.x, o.z, y1*c + x1*s + o.y); - glTexCoord2f(1, 1); glVertex3f(x2*c - y1*s + o.x, o.z, y1*c + x2*s + o.y); - glTexCoord2f(1, 0); glVertex3f(x2*c - y2*s + o.x, o.z, y2*c + x2*s + o.y); - glTexCoord2f(0, 0); glVertex3f(x1*c - y2*s + o.x, o.z, y2*c + x1*s + o.y); + glTexCoord2f(0, 1); glVertex3f(x1*c - y1*s + o.x, y1*c + x1*s + o.y, o.z); + glTexCoord2f(1, 1); glVertex3f(x2*c - y1*s + o.x, y1*c + x2*s + o.y, o.z); + glTexCoord2f(1, 0); glVertex3f(x2*c - y2*s + o.x, y2*c + x2*s + o.y, o.z); + glTexCoord2f(0, 0); glVertex3f(x1*c - y2*s + o.x, y2*c + x1*s + o.y, o.z); glEnd(); glDepthMask(GL_TRUE); diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index c6185cc3..3086c6ca 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -409,7 +409,7 @@ void renderbounceents() } } path(model); - rendermodel(model, ANIM_MAPMODEL|ANIM_LOOP, 0, 1.1f, p->o.x, z, p->o.y, p->yaw, p->pitch, 10.0f); + rendermodel(model, ANIM_MAPMODEL|ANIM_LOOP, 0, 1.1f, p->o.x, p->o.y, z, p->yaw, p->pitch, 10.0f); } }