diff --git a/polymer/build/include/build.h b/polymer/build/include/build.h index de9bfbca9..bca8e6785 100644 --- a/polymer/build/include/build.h +++ b/polymer/build/include/build.h @@ -210,6 +210,7 @@ struct validmode_t { EXTERN struct validmode_t validmode[MAXVALIDMODES]; EXTERN short numsectors, numwalls; +EXTERN char display_mirror; EXTERN /*volatile*/ int totalclock; EXTERN int numframes, randomseed; EXTERN short sintable[2048]; diff --git a/polymer/build/include/polymer.h b/polymer/build/include/polymer.h index 735195d2a..733df63e1 100644 --- a/polymer/build/include/polymer.h +++ b/polymer/build/include/polymer.h @@ -129,6 +129,9 @@ void polymer_drawsprite(int snum); # ifdef POLYMER_C extern int globalposx, globalposy, globalposz, globalhoriz; +extern short globalang, globalcursectnum; +extern int globalpal, cosglobalang, singlobalang; +extern int cosviewingrangeglobalang, sinviewingrangeglobalang; // CORE static void polymer_displayrooms(short sectnum); diff --git a/polymer/build/src/polymer.c b/polymer/build/src/polymer.c index ba48dbd99..b4eb44287 100644 --- a/polymer/build/src/polymer.c +++ b/polymer/build/src/polymer.c @@ -278,6 +278,10 @@ void polymer_drawrooms(int daposx, int daposy, int daposz, short viewangle = daang; curmodelviewmatrix = rootmodelviewmatrix; + cosglobalang = sintable[(viewangle+512)&2047]; + singlobalang = sintable[viewangle&2047]; + cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange); + sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange); if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n"); } @@ -290,7 +294,9 @@ void polymer_drawmasks(void) while (spritesortcnt) { - polymer_drawsprite(--spritesortcnt); + spritesortcnt--; + tspriteptr[spritesortcnt] = &tsprite[spritesortcnt]; + polymer_drawsprite(spritesortcnt); } bglDisable(GL_POLYGON_OFFSET_FILL); @@ -644,7 +650,15 @@ static void polymer_displayrooms(short dacursectnum) if (depth) { + cosglobalang = sintable[(viewangle+512)&2047]; + singlobalang = sintable[viewangle&2047]; + cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange); + sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange); + + display_mirror = 1; polymer_animatesprites(); + display_mirror = 0; + bglDisable(GL_CULL_FACE); drawmasks(); bglEnable(GL_CULL_FACE); @@ -715,6 +729,10 @@ static void polymer_drawplane(short sectnum, short wallnum, GLuint glpic bglCullFace(GL_FRONT); bglEnable(GL_CLIP_PLANE0); + if (wallnum >= 0) + preparemirror(globalposx, globalposy, 0, globalang, + 0, wallnum, 0, &gx, &gy, &viewangle); + gx = globalposx; gy = globalposy; gz = globalposz; @@ -807,7 +825,7 @@ static void polymer_inb4mirror(GLfloat* buffer, GLdouble* plane) static void polymer_animatesprites(void) { - asi.animatesprites(asi.x, asi.y, asi.a, asi.smoothratio); + asi.animatesprites(globalposx, globalposy, viewangle, asi.smoothratio); } // SECTORS @@ -1644,7 +1662,7 @@ static void polymer_updatewall(short wallnum) memcpy(&w->bigportal[6], &s->ceilbuffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3); memcpy(&w->bigportal[9], &s->ceilbuffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3); - polymer_buffertoplane(w->portal, NULL, w->plane); + polymer_buffertoplane(w->bigportal, NULL, w->plane); w->controlstate = 1; @@ -1674,7 +1692,7 @@ static void polymer_drawwall(short sectnum, short wallnum) if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing wall %i...\n", wallnum); } -#define INDICE(n) ((indices) ? (indices[i+n]*5) : ((i+n)*5)) +#define INDICE(n) ((indices) ? (indices[i+n]*5) : ((i+n)*3)) // HSR static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, GLdouble* plane) diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index f5b3ab575..652d780f1 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -113,7 +113,7 @@ intptr_t *script = NULL; int g_ScriptSize = 16384; -char display_mirror,typebuflen,typebuf[141]; +char typebuflen,typebuf[141]; char *music_fn[MAXVOLUMES+1][MAXLEVELS],music_select; char env_music_fn[MAXVOLUMES+1][BMAX_PATH];