From 67e2466b0e44017ec1649c2b34b7cbdb962152b4 Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 10 May 2008 01:29:37 +0000 Subject: [PATCH] Patch from hunter_rus git-svn-id: https://svn.eduke32.com/eduke32@723 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/Makefile | 7 +- polymer/build/Makefile.shared | 7 + polymer/build/include/build.h | 4 +- polymer/build/src/a-c.c | 2 +- polymer/build/src/build.c | 4 +- polymer/build/src/cache1d.c | 2 +- polymer/build/src/dynamicgtk.c | 6 +- polymer/build/src/engine.c | 35 +++- polymer/build/src/glbuild.c | 2 +- polymer/build/src/mdsprite.c | 27 +-- polymer/build/src/osd.c | 23 ++- polymer/build/src/polymer.c | 245 +++++++++++++------------ polymer/build/src/polymost.c | 39 ++-- polymer/build/src/sdlayer.c | 3 +- polymer/build/src/startwin.editor.c | 4 +- polymer/build/src/winlayer.c | 2 + polymer/eduke32/Makefile | 1 + polymer/eduke32/source/actors.c | 2 +- polymer/eduke32/source/astub.c | 39 +++- polymer/eduke32/source/config.c | 1 - polymer/eduke32/source/duke3d.h | 3 + polymer/eduke32/source/game.c | 16 +- polymer/eduke32/source/gamedef.c | 2 + polymer/eduke32/source/gamedef.h | 1 + polymer/eduke32/source/gameexec.c | 9 + polymer/eduke32/source/osdcmds.c | 10 +- polymer/eduke32/source/sounds.c | 50 ++--- polymer/eduke32/source/startwin.game.c | 4 +- 28 files changed, 324 insertions(+), 226 deletions(-) diff --git a/polymer/build/Makefile b/polymer/build/Makefile index b1e993fd3..f948868ab 100644 --- a/polymer/build/Makefile +++ b/polymer/build/Makefile @@ -16,6 +16,7 @@ SUPERBUILD ?= 1 POLYMOST ?= 1 +POLYMER ?= 1 USE_OPENGL ?= 1 NOASM ?= 0 LINKED_GTK ?= 0 @@ -88,8 +89,10 @@ ENGINEOBJS+= \ $(OBJ)/mmulti.$o \ $(OBJ)/osd.$o \ $(OBJ)/pragmas.$o \ - $(OBJ)/scriptfile.$o \ - $(OBJ)/polymer.$o + $(OBJ)/scriptfile.$o +ifeq (1,$(POLYMER)) + ENGINEOBJS+= $(OBJ)/polymer.$o +endif EDITOROBJS=$(OBJ)/build.$o \ $(OBJ)/config.$o diff --git a/polymer/build/Makefile.shared b/polymer/build/Makefile.shared index d4c9e0815..efd330e56 100644 --- a/polymer/build/Makefile.shared +++ b/polymer/build/Makefile.shared @@ -155,3 +155,10 @@ ifneq (0,$(LINKED_GTK)) BUILDCFLAGS+= -DLINKED_GTK endif +ifneq (0,$(POLYMER)) + ifneq (0,$(POLYMOST)) + ifneq (0,$(USE_OPENGL)) + BUILDCFLAGS+= -DPOLYMER + endif + endif +endif diff --git a/polymer/build/include/build.h b/polymer/build/include/build.h index bca8e6785..5dd251c00 100644 --- a/polymer/build/include/build.h +++ b/polymer/build/include/build.h @@ -481,9 +481,11 @@ _equation equation(int x1, int y1, int x2, int y2); int sameside(_equation* eq, _point2d* p1, _point2d* p2); int wallvisible(short wallnum); +#ifdef POLYMER // polymer stuff for the game to provide it with the animatessprites ptr typedef void (*animatespritesptr)(int, int, int, int); EXTERN void polymer_setanimatesprites(animatespritesptr, int, int, int, int); +#endif #define STATUS2DSIZ 144 void qsetmode640350(void); @@ -565,7 +567,7 @@ int md_undefinemodel(int modelid); #define MAXPALCONV 200 void clearconv(); void setpalconv(int pal,int pal1,int pal2); -void getpalmap(int stage,int *pal1,int *pal2); +void getpalmap(int *stage,int *pal1,int *pal2); int checkpalmaps(int pal); void applypalmap(char *pic, char *palmap, int size, int pal); diff --git a/polymer/build/src/a-c.c b/polymer/build/src/a-c.c index d0cf8e181..6b06d6c43 100644 --- a/polymer/build/src/a-c.c +++ b/polymer/build/src/a-c.c @@ -63,7 +63,7 @@ void slopevlin(intptr_t p, int i, intptr_t slopaloffs, int cnt, int bx, int by) unsigned int u, v; bz = asm3; bzinc = (asm1>>3); - slopalptr = (int* )slopaloffs; + slopalptr = (int*)slopaloffs; for (;cnt>0;cnt--) { i = krecip(bz>>6); bz += bzinc; diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 1914c6f15..e6585f76b 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -235,7 +235,7 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm) return OSDCMD_SHOWHELP; } - if (qsetmode != 200) + if (qsetmode != 200) { qsetmodeany(newx,newy); xdim2d = xdim; @@ -3162,6 +3162,7 @@ void overheadeditor(void) drawline16(0,searchy,8,searchy,15); col = 15-((gridlock<<1)+gridlock); + if (joinsector[0] >= 0)col = 11; drawline16(searchx,searchy-8,searchx,searchy-1,col); drawline16(searchx+1,searchy-8,searchx+1,searchy-1,col); drawline16(searchx,searchy+2,searchx,searchy+9,col); @@ -5587,6 +5588,7 @@ void overheadeditor(void) printmessage16("Arrow must be inside a sector before entering 3D mode."); } CANCEL: + if (keystatus[1] > 0 && joinsector[0] >= 0){keystatus[1]=0;joinsector[0]=-1;} if (keystatus[1] > 0) { keystatus[1] = 0; diff --git a/polymer/build/src/cache1d.c b/polymer/build/src/cache1d.c index d15f9aa31..2a1d42408 100644 --- a/polymer/build/src/cache1d.c +++ b/polymer/build/src/cache1d.c @@ -115,7 +115,7 @@ void allocache(intptr_t *newhandle, int newbytes, char *newlockptr) // Make all requests a multiple of 16 bytes newbytes = (newbytes+15)&0xfffffff0; //printf("allocated %d bytes\n", newbytes); - + if ((unsigned)newbytes > (unsigned)cachesize) { Bprintf("Cachesize: %d\n",cachesize); diff --git a/polymer/build/src/dynamicgtk.c b/polymer/build/src/dynamicgtk.c index 99a92ae5a..060c87fe4 100755 --- a/polymer/build/src/dynamicgtk.c +++ b/polymer/build/src/dynamicgtk.c @@ -100,12 +100,12 @@ int dynamicgtk_init(void) GETDLSYM(gtk_text_buffer_delete_mark) GETDLSYM(gtk_text_buffer_get_end_iter) GETDLSYM(gtk_text_buffer_insert) - // FIXME: should I put a #if !GTK_CHECK_VERSION(2,6,0) - // around these three, or should I not care?? + // FIXME: should I put a #if !GTK_CHECK_VERSION(2,6,0) + // around these three, or should I not care?? GETDLSYM(gtk_text_iter_backward_cursor_position) GETDLSYM(gtk_text_iter_equal) GETDLSYM(gtk_text_buffer_delete_interactive) - // + // GETDLSYM(gtk_text_view_get_buffer) GETDLSYM(gtk_text_view_get_type) GETDLSYM(gtk_text_view_new) diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 02f0e023c..2b6cd6294 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -27,9 +27,11 @@ # endif # ifdef USE_OPENGL # include "glbuild.h" +# ifdef POLYMER # include "polymer.h" # endif #endif +#endif #include @@ -3188,7 +3190,7 @@ static void drawsprite(int snum) # endif return; } -# ifdef USE_OPENGL +# ifdef POLYMER if (rendmode == 4) { bglEnable(GL_ALPHA_TEST); @@ -4124,6 +4126,7 @@ static void drawmaskwall(short damaskwallcnt) //============================================================================= //POLYMOST BEGINS #ifdef POLYMOST if (rendmode == 3) { polymost_drawmaskwall(damaskwallcnt); return; } +# ifdef POLYMER if (rendmode == 4) { bglEnable(GL_ALPHA_TEST); @@ -4136,6 +4139,7 @@ static void drawmaskwall(short damaskwallcnt) return; } +#endif #endif //============================================================================= //POLYMOST ENDS @@ -4626,7 +4630,9 @@ static void dorotatesprite(int sx, int sy, int z, short a, short picnum, signed //============================================================================= //POLYMOST BEGINS #ifdef POLYMOST if (rendmode >= 3) { polymost_dorotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2,uniqid); return; } +# ifdef POLYMER if (rendmode == 4) { polymer_rotatesprite(sx,sy,z,a,picnum,dashade,dapalnum,dastat,cx1,cy1,cx2,cy2); return; } +#endif #endif //============================================================================= //POLYMOST ENDS @@ -5855,6 +5861,7 @@ void drawrooms(int daposx, int daposy, int daposz, dmost[0] = shortptr2[0]-windowy1; #ifdef POLYMOST +# ifdef POLYMER if (rendmode == 4) { polymer_glinit(); @@ -5863,6 +5870,7 @@ void drawrooms(int daposx, int daposy, int daposz, gloy1 = 0; return; } +# endif //============================================================================= //POLYMOST BEGINS polymost_drawrooms(); @@ -6127,7 +6135,7 @@ void drawmasks(void) _equation maskeq, p1eq, p2eq; _point2d dot, dot2, middle, pos, spr; -#ifdef USE_OPENGL +#ifdef POLYMER if ((rendmode == 4) && 0) { polymer_drawmasks(); @@ -6812,10 +6820,10 @@ int loadboard(char *filename, char fromwhere, int *daposx, int *daposy, int *dap sprite[i].hitag = B_LITTLE16(sprite[i].hitag); sprite[i].extra = B_LITTLE16(sprite[i].extra); - if(sprite[i].sectnum<0||sprite[i].sectnum>=MYMAXSECTORS) + if (sprite[i].sectnum<0||sprite[i].sectnum>=MYMAXSECTORS) { - initprintf("Map error: sprite #%d(%d,%d) with wrong sector(%d)\n",i,sprite[i].x,sprite[i].y,sprite[i].sectnum); - sprite[i].sectnum=MYMAXSECTORS-1; + initprintf("Map error: sprite #%d(%d,%d) with wrong sector(%d)\n",i,sprite[i].x,sprite[i].y,sprite[i].sectnum); + sprite[i].sectnum=MYMAXSECTORS-1; } } @@ -6834,8 +6842,10 @@ int loadboard(char *filename, char fromwhere, int *daposx, int *daposy, int *dap memset(spriteext, 0, sizeof(spriteexttype) * MAXSPRITES); memset(spritesmooth, 0, sizeof(spritesmooth)); +# ifdef POLYMER if (rendmode == 4) polymer_loadboard(); +#endif #endif guniqhudid = 0; @@ -7768,8 +7778,10 @@ int setgamemode(char davidoption, int daxdim, int daydim, int dabpp) polymost_glreset(); polymost_glinit(); } +# ifdef POLYMER if (rendmode == 4) polymer_glinit(); +#endif #endif qsetmode = 200; return(0); @@ -7844,9 +7856,9 @@ void nextpage(void) { int i; - for(i=0;i 4) renderer = 4; } +# ifdef POLYMER if (renderer == 4) polymer_init(); +# else + if (renderer == 4) + renderer = 3; +# endif rendmode = renderer; #endif diff --git a/polymer/build/src/glbuild.c b/polymer/build/src/glbuild.c index ec8bf9e8f..aa52d701b 100644 --- a/polymer/build/src/glbuild.c +++ b/polymer/build/src/glbuild.c @@ -146,7 +146,7 @@ GLboolean(APIENTRY * bglUnmapBufferARB)(GLenum target); // Occlusion queries void (APIENTRY * bglGenQueriesARB)(GLsizei n, GLuint *ids); void (APIENTRY * bglDeleteQueriesARB)(GLsizei n, const GLuint *ids); -GLboolean (APIENTRY * bglIsQueryARB)(GLuint id); +GLboolean(APIENTRY * bglIsQueryARB)(GLuint id); void (APIENTRY * bglBeginQueryARB)(GLenum target, GLuint id); void (APIENTRY * bglEndQueryARB)(GLenum target); void (APIENTRY * bglGetQueryivARB)(GLenum target, GLenum pname, GLint *params); diff --git a/polymer/build/src/mdsprite.c b/polymer/build/src/mdsprite.c index 267808b23..68dbd216b 100644 --- a/polymer/build/src/mdsprite.c +++ b/polymer/build/src/mdsprite.c @@ -392,19 +392,14 @@ void setpalconv(int pal,int pal1,int pal2) } -void getpalmap(int stage,int *pal1,int *pal2) +void getpalmap(int *i,int *pal1,int *pal2) { - int i; - for (i=0;iskinmap; sk; sk = sk->next) diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index d8bfde548..5ff0c482b 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -225,17 +225,20 @@ static int _internal_osdfunc_vars(const osdfuncparm_t *parm) osdrows = atoi(parm->parms[0]); if (osdrows < 1) osdrows = 1; else if (osdrows > osdmaxrows) osdrows = osdmaxrows; - if(osdrowscur!=-1)osdrowscur = osdrows; - return OSDCMD_OK; - } - } else - if (!Bstrcasecmp(parm->name, "logcutoff")) { - if (showval) { OSD_Printf("logcutoff is %d\n", logcutoff); return OSDCMD_OK; } - else { - logcutoff = atoi(parm->parms[0]); + if (osdrowscur!=-1)osdrowscur = osdrows; return OSDCMD_OK; } } + else + if (!Bstrcasecmp(parm->name, "logcutoff")) + { + if (showval) { OSD_Printf("logcutoff is %d\n", logcutoff); return OSDCMD_OK; } + else + { + logcutoff = atoi(parm->parms[0]); + return OSDCMD_OK; + } + } return OSDCMD_SHOWHELP; } @@ -963,12 +966,12 @@ void OSD_Printf(const char *fmt, ...) Bvsnprintf(tmpstr, 1024, fmt, va); va_end(va); - if(linecnt= numsectors) || - (daposz > sector[dacursectnum].floorz) || - (daposz < sector[dacursectnum].ceilingz)) + (daposz > sector[dacursectnum].floorz) || + (daposz < sector[dacursectnum].ceilingz)) { i = 0; while (i < numsectors) @@ -458,62 +460,62 @@ void polymer_drawsprite(int snum) switch ((tspr->cstat>>4) & 3) { - case 0: - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); + case 0: + bglMatrixMode(GL_MODELVIEW); + bglPushMatrix(); - spritemodelview[12] = curmodelviewmatrix[0] * spos[0] + - curmodelviewmatrix[4] * spos[1] + - curmodelviewmatrix[8] * spos[2] + - curmodelviewmatrix[12]; - spritemodelview[13] = curmodelviewmatrix[1] * spos[0] + - curmodelviewmatrix[5] * spos[1] + - curmodelviewmatrix[9] * spos[2] + - curmodelviewmatrix[13]; - spritemodelview[14] = curmodelviewmatrix[2] * spos[0] + - curmodelviewmatrix[6] * spos[1] + - curmodelviewmatrix[10] * spos[2] + - curmodelviewmatrix[14]; + spritemodelview[12] = curmodelviewmatrix[0] * spos[0] + + curmodelviewmatrix[4] * spos[1] + + curmodelviewmatrix[8] * spos[2] + + curmodelviewmatrix[12]; + spritemodelview[13] = curmodelviewmatrix[1] * spos[0] + + curmodelviewmatrix[5] * spos[1] + + curmodelviewmatrix[9] * spos[2] + + curmodelviewmatrix[13]; + spritemodelview[14] = curmodelviewmatrix[2] * spos[0] + + curmodelviewmatrix[6] * spos[1] + + curmodelviewmatrix[10] * spos[2] + + curmodelviewmatrix[14]; - bglLoadMatrixd(spritemodelview); - bglRotatef((gtang * 90.0f), 0.0f, 0.0f, -1.0f); - bglTranslatef((float)(-xoff)/1000.0f, (float)(yoff)/1000.0f, 0.0f); - bglScalef((float)(xsize) / 1000.0f, (float)(ysize) / 1000.0f, 1.0f / 1000.0f); + bglLoadMatrixd(spritemodelview); + bglRotatef((gtang * 90.0f), 0.0f, 0.0f, -1.0f); + bglTranslatef((float)(-xoff)/1000.0f, (float)(yoff)/1000.0f, 0.0f); + bglScalef((float)(xsize) / 1000.0f, (float)(ysize) / 1000.0f, 1.0f / 1000.0f); - bglPolygonOffset(0.0f, 0.0f); - break; - case 1: - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); + bglPolygonOffset(0.0f, 0.0f); + break; + case 1: + bglMatrixMode(GL_MODELVIEW); + bglPushMatrix(); - ang = (float)((tspr->ang + 1024) & 2047) / (2048.0f / 360.0f); + ang = (float)((tspr->ang + 1024) & 2047) / (2048.0f / 360.0f); - bglTranslatef(spos[0], spos[1], spos[2]); - bglRotatef(-ang, 0.0f, 1.0f, 0.0f); - bglTranslatef((float)(-xoff), (float)(yoff), 0.0f); - bglScalef((float)(xsize), (float)(ysize), 1.0f); + bglTranslatef(spos[0], spos[1], spos[2]); + bglRotatef(-ang, 0.0f, 1.0f, 0.0f); + bglTranslatef((float)(-xoff), (float)(yoff), 0.0f); + bglScalef((float)(xsize), (float)(ysize), 1.0f); - prsectors[tspr->sectnum]->wallsproffset += 0.5f; - bglPolygonOffset(-prsectors[tspr->sectnum]->wallsproffset, - -prsectors[tspr->sectnum]->wallsproffset); - break; - case 2: - bglMatrixMode(GL_MODELVIEW); - bglPushMatrix(); + prsectors[tspr->sectnum]->wallsproffset += 0.5f; + bglPolygonOffset(-prsectors[tspr->sectnum]->wallsproffset, + -prsectors[tspr->sectnum]->wallsproffset); + break; + case 2: + bglMatrixMode(GL_MODELVIEW); + bglPushMatrix(); - ang = (float)((tspr->ang + 1024) & 2047) / (2048.0f / 360.0f); + ang = (float)((tspr->ang + 1024) & 2047) / (2048.0f / 360.0f); - bglTranslatef(spos[0], spos[1], spos[2]); - bglRotatef(-ang, 0.0f, 1.0f, 0.0f); - bglTranslatef((float)(-xoff), 1.0f, (float)(yoff)); - bglScalef((float)(xsize), 1.0f, (float)(ysize)); + bglTranslatef(spos[0], spos[1], spos[2]); + bglRotatef(-ang, 0.0f, 1.0f, 0.0f); + bglTranslatef((float)(-xoff), 1.0f, (float)(yoff)); + bglScalef((float)(xsize), 1.0f, (float)(ysize)); - curspritedata = horizsprite; + curspritedata = horizsprite; - prsectors[tspr->sectnum]->floorsproffset += 0.5f; - bglPolygonOffset(-prsectors[tspr->sectnum]->floorsproffset, - -prsectors[tspr->sectnum]->floorsproffset); - break; + prsectors[tspr->sectnum]->floorsproffset += 0.5f; + bglPolygonOffset(-prsectors[tspr->sectnum]->floorsproffset, + -prsectors[tspr->sectnum]->floorsproffset); + break; } bglMatrixMode(GL_TEXTURE); @@ -598,7 +600,7 @@ static void polymer_displayrooms(short dacursectnum) while (i < sec->wallnum) { if (((wallvisible(sec->wallptr + i))) && - (polymer_portalinfrustum(sec->wallptr + i, frustum))) + (polymer_portalinfrustum(sec->wallptr + i, frustum))) { if (mirrorfrom[depth] != (sec->wallptr + i)) polymer_drawwall(dacursectnum, sec->wallptr + i); @@ -606,7 +608,7 @@ static void polymer_displayrooms(short dacursectnum) if ((wal->cstat&48) == 16) localmaskwall[localmaskwallcnt++] = sec->wallptr + i; if ((wal->nextsector != -1) && - (drawingstate[wal->nextsector] == 0)) + (drawingstate[wal->nextsector] == 0)) { sectorqueue[back++] = wal->nextsector; drawingstate[wal->nextsector] = 1; @@ -627,8 +629,8 @@ static void polymer_displayrooms(short dacursectnum) if (querydelay[sectorqueue[front]] == 0) { bglGetQueryObjectivARB(queryid[sectorqueue[front]], - GL_QUERY_RESULT_ARB, - &result); + GL_QUERY_RESULT_ARB, + &result); bglDeleteQueriesARB(1, &queryid[sectorqueue[front]]); if (!result) { @@ -656,14 +658,14 @@ static void polymer_displayrooms(short dacursectnum) while (i < sec->wallnum) { if ((wallvisible(sec->wallptr + i)) && - (polymer_portalinfrustum(sec->wallptr + i, frustum))) + (polymer_portalinfrustum(sec->wallptr + i, frustum))) { polymer_drawwall(sectorqueue[front], sec->wallptr + i); // mask if ((wal->cstat&48) == 16) localmaskwall[localmaskwallcnt++] = sec->wallptr + i; if ((wal->nextsector != -1) && - (drawingstate[wal->nextsector] == 0)) + (drawingstate[wal->nextsector] == 0)) { polymer_pokesector(wal->nextsector); sectorqueue[back++] = wal->nextsector; @@ -675,7 +677,7 @@ static void polymer_displayrooms(short dacursectnum) nextwal = &wall[nextsec->wallptr]; if ((nextsec->ceilingstat & 1) && - (nextsec->floorz == nextsec->ceilingz)) + (nextsec->floorz == nextsec->ceilingz)) { querydelay[wal->nextsector] = -1; i++; @@ -695,9 +697,9 @@ static void polymer_displayrooms(short dacursectnum) while (j < nextsec->wallnum) { if ((nextwal->nextwall == (sec->wallptr + i)) || - ((nextwal->nextwall != -1) && - (wallvisible(nextwal->nextwall)) && - (polymer_portalinfrustum(nextwal->nextwall, frustum)))) + ((nextwal->nextwall != -1) && + (wallvisible(nextwal->nextwall)) && + (polymer_portalinfrustum(nextwal->nextwall, frustum)))) { w = prwalls[nextwal->nextwall]; bglVertexPointer(3, GL_FLOAT, 5 * sizeof(GLfloat), w->portal); @@ -769,7 +771,7 @@ static void polymer_drawplane(short sectnum, short wallnum, GLuint glpic { if ((depth < 1) && (plane != NULL) && - (wallnum >= 0) && (wall[wallnum].overpicnum == 560)) // insert mirror condition here + (wallnum >= 0) && (wall[wallnum].overpicnum == 560)) // insert mirror condition here { int gx, gy, gz, px, py, pz; float coeff; @@ -876,7 +878,7 @@ static void polymer_drawplane(short sectnum, short wallnum, GLuint glpic OMGDRAWSHIT; if ((depth < 1) && (plane != NULL) && - (wallnum >= 0) && (wall[wallnum].overpicnum == 560)) // insert mirror condition here + (wallnum >= 0) && (wall[wallnum].overpicnum == 560)) // insert mirror condition here { bglDisable(GL_STENCIL_TEST); bglClear(GL_STENCIL_BUFFER_BIT); @@ -1005,10 +1007,10 @@ static int polymer_updatesector(short sectnum) } if ((s->controlstate == 2) || - (sec->floorz != s->floorz) || - (sec->ceilingz != s->ceilingz) || - (sec->floorheinum != s->floorheinum) || - (sec->ceilingheinum != s->ceilingheinum)) + (sec->floorz != s->floorz) || + (sec->ceilingz != s->ceilingz) || + (sec->floorheinum != s->floorheinum) || + (sec->ceilingheinum != s->ceilingheinum)) { wallinvalidate = 1; @@ -1036,14 +1038,14 @@ static int polymer_updatesector(short sectnum) if (picanm[ceilingpicnum]&192) ceilingpicnum += animateoffs(ceilingpicnum,sectnum); if ((s->controlstate != 2) && (!needfloor) && - (sec->floorstat == s->floorstat) && - (sec->ceilingstat == s->ceilingstat) && - (floorpicnum == s->floorpicnum) && - (ceilingpicnum == s->ceilingpicnum) && - (sec->floorxpanning == s->floorxpanning) && - (sec->ceilingxpanning == s->ceilingxpanning) && - (sec->floorypanning == s->floorypanning) && - (sec->ceilingypanning == s->ceilingypanning)) + (sec->floorstat == s->floorstat) && + (sec->ceilingstat == s->ceilingstat) && + (floorpicnum == s->floorpicnum) && + (ceilingpicnum == s->ceilingpicnum) && + (sec->floorxpanning == s->floorxpanning) && + (sec->ceilingxpanning == s->ceilingxpanning) && + (sec->floorypanning == s->floorypanning) && + (sec->ceilingypanning == s->ceilingypanning)) goto attributes; wal = &wall[sec->wallptr]; @@ -1072,7 +1074,7 @@ static int polymer_updatesector(short sectnum) loadtile(curpicnum); if (((sec->floorstat & 64) || (sec->ceilingstat & 64)) && - ((secangcos == 2) && (secangsin == 2))) + ((secangcos == 2) && (secangsin == 2))) { ang = (getangle(wall[wal->point2].x - wal->x, wall[wal->point2].y - wal->y) + 512) & 2047; secangcos = (float)(sintable[(ang+512)&2047]) / 16383.0f; @@ -1132,10 +1134,10 @@ static int polymer_updatesector(short sectnum) attributes: if ((s->controlstate != 2) && - (sec->floorshade == s->floorshade) && - (sec->floorpal == s->floorpal) && - (floorpicnum == s->floorpicnum) && - (ceilingpicnum == s->ceilingpicnum)) + (sec->floorshade == s->floorshade) && + (sec->floorpal == s->floorpal) && + (floorpicnum == s->floorpicnum) && + (ceilingpicnum == s->ceilingpicnum)) goto finish; i = 0; @@ -1407,21 +1409,21 @@ static void polymer_updatewall(short wallnum) nwallpicnum = 0; if ((w->controlstate != 2) && - (w->invalidid == invalid) && - (wal->cstat == w->cstat) && - (wallpicnum == w->picnum) && - (wal->pal == w->pal) && - (wal->xpanning == w->xpanning) && - (wal->ypanning == w->ypanning) && - (wal->xrepeat == w->xrepeat) && - (wal->yrepeat == w->yrepeat) && - (walloverpicnum == w->overpicnum) && - (wal->shade == w->shade) && - ((nwallnum == -1) || - ((nwallpicnum == w->nwallpicnum) && - (wall[nwallnum].xpanning == w->nwallxpanning) && - (wall[nwallnum].ypanning == w->nwallypanning) && - (wall[nwallnum].cstat == w->nwallcstat)))) + (w->invalidid == invalid) && + (wal->cstat == w->cstat) && + (wallpicnum == w->picnum) && + (wal->pal == w->pal) && + (wal->xpanning == w->xpanning) && + (wal->ypanning == w->ypanning) && + (wal->xrepeat == w->xrepeat) && + (wal->yrepeat == w->yrepeat) && + (walloverpicnum == w->overpicnum) && + (wal->shade == w->shade) && + ((nwallnum == -1) || + ((nwallpicnum == w->nwallpicnum) && + (wall[nwallnum].xpanning == w->nwallxpanning) && + (wall[nwallnum].ypanning == w->nwallypanning) && + (wall[nwallnum].cstat == w->nwallcstat)))) { w->controlstate = 1; return; // screw you guys I'm going home @@ -1475,7 +1477,7 @@ static void polymer_updatewall(short wallnum) w->wallfbglpic = 0; w->wallcolor[0] = w->wallcolor[1] = w->wallcolor[2] = - ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); + ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); w->wallcolor[3] = 1.0f; if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) @@ -1531,9 +1533,9 @@ static void polymer_updatewall(short wallnum) nnwallnum = wall[nwallnum].point2; if (((s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || - (s->floorbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) && - ((s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] <= ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || - (s->floorbuffer[((wal->point2 - sec->wallptr) * 5) + 1] <= ns->floorbuffer[((nwallnum - nsec->wallptr) * 5) + 1]))) + (s->floorbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->floorbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) && + ((s->floorbuffer[((wallnum - sec->wallptr) * 5) + 1] <= ns->floorbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || + (s->floorbuffer[((wal->point2 - sec->wallptr) * 5) + 1] <= ns->floorbuffer[((nwallnum - nsec->wallptr) * 5) + 1]))) underwall = 1; if ((underwall) || (wal->cstat & 16)) @@ -1572,7 +1574,7 @@ static void polymer_updatewall(short wallnum) w->wallfbglpic = 0; w->wallcolor[0] = w->wallcolor[1] = w->wallcolor[2] = - ((float)(numpalookups-min(max(curshade,0),numpalookups)))/((float)numpalookups); + ((float)(numpalookups-min(max(curshade,0),numpalookups)))/((float)numpalookups); w->wallcolor[3] = 1.0f; if (pth && (pth->flags & 2) && (pth->palnum != curpal)) @@ -1629,9 +1631,9 @@ static void polymer_updatewall(short wallnum) } if (((s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || - (s->ceilbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) && - ((s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] >= ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || - (s->ceilbuffer[((wal->point2 - sec->wallptr) * 5) + 1] >= ns->ceilbuffer[((nwallnum - nsec->wallptr) * 5) + 1]))) + (s->ceilbuffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->ceilbuffer[((nwallnum - nsec->wallptr) * 5) + 1])) && + ((s->ceilbuffer[((wallnum - sec->wallptr) * 5) + 1] >= ns->ceilbuffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || + (s->ceilbuffer[((wal->point2 - sec->wallptr) * 5) + 1] >= ns->ceilbuffer[((nwallnum - nsec->wallptr) * 5) + 1]))) overwall = 1; if ((overwall) || (wal->cstat & 16)) @@ -1662,7 +1664,7 @@ static void polymer_updatewall(short wallnum) w->maskglpic = pth ? pth->glpic : 0; w->maskcolor[0] = w->maskcolor[1] = w->maskcolor[2] = - ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); + ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); w->maskcolor[3] = 1.0f; if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) @@ -1691,7 +1693,7 @@ static void polymer_updatewall(short wallnum) w->overfbglpic = 0; w->overcolor[0] = w->overcolor[1] = w->overcolor[2] = - ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); + ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); w->overcolor[3] = 1.0f; if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) @@ -1828,8 +1830,8 @@ static void polymer_drawwall(short sectnum, short wallnum) } if ((sector[sectnum].ceilingstat & 1) && - ((wall[wallnum].nextsector == -1) || - !(sector[wall[wallnum].nextsector].ceilingstat & 1))) + ((wall[wallnum].nextsector == -1) || + !(sector[wall[wallnum].nextsector].ceilingstat & 1))) { bglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); bglVertexPointer(3, GL_FLOAT, 0, w->cap); @@ -1849,7 +1851,8 @@ static void polymer_buffertoplane(GLfloat* buffer, GLushort* indices, in int i; i = 0; - do { + do + { vec1[0] = buffer[(INDICE(1)) + 0] - buffer[(INDICE(0)) + 0]; vec1[1] = buffer[(INDICE(1)) + 1] - buffer[(INDICE(0)) + 1]; vec1[2] = buffer[(INDICE(1)) + 2] - buffer[(INDICE(0)) + 2]; @@ -1974,8 +1977,8 @@ static void polymer_scansprites(short sectnum, spritetype* localtsprite, { spr = &sprite[i]; if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) && - (spr->xrepeat > 0) && (spr->yrepeat > 0) && - (*localspritesortcnt < MAXSPRITESONSCREEN)) + (spr->xrepeat > 0) && (spr->yrepeat > 0) && + (*localspritesortcnt < MAXSPRITESONSCREEN)) { copybufbyte(spr,&localtsprite[*localspritesortcnt],sizeof(spritetype)); localtsprite[(*localspritesortcnt)++].owner = i; diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index e27107a8e..f4e77ce90 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -437,12 +437,7 @@ pthtyp * gltexcache(int dapicnum, int dapalnum, int dameth) if (pth2->flags & 8) pth->flags |= 8; //hasalpha pth->hicr = si; pth->next = gltexcachead[j]; - if (pth->palmap) - { - //_initprintf("Realloc #%d->#%d\n",pth2->palmap, pth->palmap); - pth->palmap=malloc(pth->size*4); - memcpy(pth->palmap, pth2->palmap, pth->size*4); - } + gltexcachead[j] = pth; return(pth); } @@ -1449,18 +1444,23 @@ failure: return -1; } // --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF -static void applypalmapsT(char *pic, int sizx, int sizy, int pal) +static void applypalmapsT(char *pic, int sizx, int sizy, int dapic,int dapalnum, int dameth) { //_initprintf("%d\n",pal); int stage; + pthtyp *pichead1=pichead; + for (stage=0;stagenext) + //_initprintf("Pal: %d\n",pal1); + if (hicfindsubst(dapic, pal1, 0)) + gltexcache(dapic, pal1, dameth); + for (pth=pichead1; pth; pth=pth->next) if (pth->palnum ==pal1&&pth->palmap)break; if (!pth||pth->size!=sizx*sizy)continue; @@ -1549,7 +1549,7 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet pic = (coltype *)calloc(xsiz,ysiz*sizeof(coltype)); if (!pic) { free(picfil); return 1; } if (kprender(picfil,picfillen,(int)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) { free(picfil); free(pic); return -2; } - applypalmapsT((char *)pic,tsizx,tsizy,dapalnum); + applypalmapsT((char *)pic,tsizx,tsizy,dapic,dapalnum,dameth); r=(glinfo.bgra)?hictinting[dapalnum].r:hictinting[dapalnum].b; g=hictinting[dapalnum].g; @@ -1632,7 +1632,6 @@ int gloadtile_hi(int dapic,int dapalnum, int facen, hicreplctyp *hicr, int damet memcpy(pth->palmap,pic,pth->size*4); } cachefil=0; - //_initprintf("#%d\n",pth->palmap); } fixtransparency(pic,tsizx,tsizy,xsiz,ysiz,dameth); uploadtexture(doalloc,xsiz,ysiz,intexfmt,texfmt,pic,-1,tsizy,dameth); @@ -1806,12 +1805,6 @@ void drawpoly(double *dpx, double *dpy, int n, int method) { float hackscx, hackscy; - int pal1; - if (usehightile) - for (pal1=SPECPAL;pal1<=REDPAL;pal1++) - if (hicfindsubst(globalpicnum, pal1, 0)) - gltexcache(globalpicnum, pal1, method&(~3)); - if (skyclamphack) method |= 4; pth = gltexcache(globalpicnum,globalpal,method&(~3)); @@ -3789,7 +3782,10 @@ static void polymost_drawalls(int bunch) yoffs=(i-tilesizy[globalpicnum])*(255./i); if (!(nwal->cstat&4)) { - if (ypan>256-yoffs){ypan-=yoffs;initprintf("FL\n");} + if (ypan>256-yoffs) + { + ypan-=yoffs; + } } else { @@ -5911,7 +5907,6 @@ void polymost_precache(int dapicnum, int dapalnum, int datype) // basically this just means walls are repeating // while sprites are clamped int mid; - int pal1; if (rendmode < 3) return; @@ -5919,9 +5914,7 @@ void polymost_precache(int dapicnum, int dapalnum, int datype) //OSD_Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype); hicprecaching = 1; - for (pal1=SPECPAL;pal1<=REDPAL;pal1++) - if (hicfindsubst(globalpicnum, pal1, 0)) - gltexcache(globalpicnum, pal1, (datype & 1) << 2); + gltexcache(dapicnum, dapalnum, (datype & 1) << 2); hicprecaching = 0; diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index 25c6eda72..c8701e5a6 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -227,7 +227,8 @@ int initsystem(void) linked->major, linked->minor, linked->patch); if (SDL_VERSIONNUM(linked->major,linked->minor,linked->patch) < SDL_REQUIREDVERSION) - { /*reject running under SDL versions older than what is stated in sdl_inc.h */ + { + /*reject running under SDL versions older than what is stated in sdl_inc.h */ initprintf("You need at least v%d.%d.%d of SDL to run this game\n",SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z); return -1; } diff --git a/polymer/build/src/startwin.editor.c b/polymer/build/src/startwin.editor.c index 4eb4b493c..78f5ee025 100755 --- a/polymer/build/src/startwin.editor.c +++ b/polymer/build/src/startwin.editor.c @@ -70,14 +70,14 @@ static void PopulateForm(void) Bsprintf(buf, "%d x %d %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp); j = ComboBox_AddString(hwnd3d, buf); (void)ComboBox_SetItemData(hwnd3d, j, i); - if (i == mode3d) (void)ComboBox_SetCurSel(hwnd3d, j); + if (i == mode3d)(void)ComboBox_SetCurSel(hwnd3d, j); // only 8-bit modes get used for 2D if (validmode[i].bpp != 8 || validmode[i].xdim < 640 || validmode[i].ydim < 480) continue; Bsprintf(buf, "%d x %d", validmode[i].xdim, validmode[i].ydim); j = ComboBox_AddString(hwnd2d, buf); (void)ComboBox_SetItemData(hwnd2d, j, i); - if (i == mode2d) (void)ComboBox_SetCurSel(hwnd2d, j); + if (i == mode2d)(void)ComboBox_SetCurSel(hwnd2d, j); } } diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index 20bc73ee0..0d57e9d4d 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -47,6 +47,7 @@ int _buildargc = 0; const char **_buildargv = NULL; static char *argvbuf = NULL; extern int app_main(int argc, const char *argv[]); +extern void app_crashhandler(void); // Windows crud static HINSTANCE hInstance = 0; @@ -250,6 +251,7 @@ static void SignalHandler(int signum) { case SIGSEGV: printOSD("Fatal Signal caught: SIGSEGV. Bailing out.\n"); + app_crashhandler(); uninitsystem(); if (stdout) fclose(stdout); break; diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 9fbe791cb..aaeed8154 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -7,6 +7,7 @@ ALROOT=AL # Engine options SUPERBUILD = 1 POLYMOST = 1 +POLYMER = 1 USE_OPENGL = 1 NOASM = 0 LINKED_GTK = 0 diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index c48002814..435284769 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -1331,7 +1331,7 @@ BOLT: static void movestandables(void) { int i = headspritestat[6], j, k, nexti, nextj, p=0, sect, switchpicnum; - int l=0, x; + int l=0, x; intptr_t *t; spritetype *s; short m; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 960819e3e..7e0091a5e 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -6025,6 +6025,32 @@ int ExtInit(void) return rv; } +#ifdef RENDERTYPEWIN +void app_crashhandler(void) +{ + if (levelname[0]) + { + char *f; + fixspritesectors(); //Do this before saving! + updatesector(startposx,startposy,&startsectnum); + if (pathsearchmode) f = levelname; + else + { + // virtual filesystem mode can't save to directories so drop the file into + // the current directory + f = strrchr(levelname, '/'); + if (!f) f = levelname; else f++; + } + ExtPreSaveMap(); + saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum); + ExtSaveMap(f); + message("Board saved"); + asksave = 0; + keystatus[0x1f] = 0; + } +} +#endif + void ExtUnInit(void) { int i; @@ -6234,11 +6260,20 @@ static void Keys2d3d(void) { if (levelname[0]) { + char *f; fixspritesectors(); //Do this before saving! updatesector(startposx,startposy,&startsectnum); + if (pathsearchmode) f = levelname; + else + { + // virtual filesystem mode can't save to directories so drop the file into + // the current directory + f = strrchr(levelname, '/'); + if (!f) f = levelname; else f++; + } ExtPreSaveMap(); - saveboard(levelname,&startposx,&startposy,&startposz,&startang,&startsectnum); - ExtSaveMap(levelname); + saveboard(f,&startposx,&startposy,&startposz,&startang,&startsectnum); + ExtSaveMap(f); message("Board saved"); asksave = 0; keystatus[0x1f] = 0; diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index d5bf8ae44..457f401c8 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -641,7 +641,6 @@ int32 CONFIG_ReadSetup(void) SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyClamping", &r_parallaxskyclamping); SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "GLParallaxSkyPanning", &r_parallaxskypanning); - dummy = usemodels; SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "UseModels",&dummy); usemodels = dummy != 0; diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 97328090b..2ff86aabd 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -36,6 +36,9 @@ extern "C" { #include "a.h" #include "build.h" #if defined(POLYMOST) && defined(USE_OPENGL) +# include "polymost.h" +#endif +#ifdef POLYMER # include "polymer.h" #endif #include "cache1d.h" diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3e3b34bdd..f7c29b404 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -4042,8 +4042,10 @@ void displayrooms(int snum,int smoothratio) #ifdef SE40 se40code(s->x,s->y,s->z,ud.cameraang,s->yvel,smoothratio); #endif +#ifdef POLYMER if (rendmode == 4) polymer_setanimatesprites(animatesprites, s->x, s->y, ud.cameraang, smoothratio); +#endif drawrooms(s->x,s->y,s->z-(4<<8),ud.cameraang,s->yvel,s->sectnum); animatesprites(s->x,s->y,ud.cameraang,smoothratio); drawmasks(); @@ -4216,8 +4218,10 @@ void displayrooms(int snum,int smoothratio) gotpic[MIRROR>>3] &= ~(1<<(MIRROR&7)); } +#ifdef POLYMER if (rendmode == 4) polymer_setanimatesprites(animatesprites, ud.camerax,ud.cameray,ud.cameraang,smoothratio); +#endif drawrooms(ud.camerax,ud.cameray,ud.cameraz,ud.cameraang,ud.camerahoriz,ud.camerasect); animatesprites(ud.camerax,ud.cameray,ud.cameraang,smoothratio); drawmasks(); @@ -10181,6 +10185,14 @@ void backtomenu(void) else wm_setapptitle(HEAD); } +#ifdef RENDERTYPEWIN +void app_crashhandler(void) +{ + closedemowrite(); + sendquit(); +} +#endif + void app_main(int argc,const char **argv) { int i, j; @@ -11053,7 +11065,7 @@ RECHECK: ud.recstat = 2; which_demo++; if (which_demo == 10) which_demo = 1; - if (enterlevel(MODE_DEMO)) return 1; + if (enterlevel(MODE_DEMO)) ud.recstat = foundemo = 0; } if (foundemo == 0 || in_menu || KB_KeyWaiting() || numplayers > 1) @@ -11924,8 +11936,8 @@ static int domovethings(void) pan3dsound(); } +#ifdef POLYMER //polymer invalidate -#if defined(POLYMOST) && defined(USE_OPENGL) updatesectors = 1; #endif diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 36462540e..bf5debcb6 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -450,6 +450,7 @@ static const char *keyw[] = "resizearray", // 318 "writearraytofile", // 319 "readarrayfromfile", // 320 + "starttrackvar", // 321 "" }; @@ -3287,6 +3288,7 @@ static int parsecommand(void) case CON_SAVEGAMEVAR: case CON_READGAMEVAR: case CON_USERQUOTE: + case CON_STARTTRACKVAR: transvar(); return 0; diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 0ed19cd8e..6b9fdc4e3 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -810,4 +810,5 @@ enum keywords CON_RESIZEARRAY, // 318 CON_WRITEARRAYTOFILE, // 319 CON_READARRAYFROMFILE, // 320 + CON_STARTTRACKVAR, // 321 }; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 3ebba2685..2870a59d0 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -5597,8 +5597,10 @@ static int parse(void) gotpic[MIRROR>>3] &= ~(1<<(MIRROR&7)); } +#ifdef POLYMER if (rendmode == 4) polymer_setanimatesprites(animatesprites, x,y,a,smoothratio); +#endif drawrooms(x,y,z,a,horiz,sect); display_mirror = 2; animatesprites(x,y,a,smoothratio); @@ -7027,6 +7029,13 @@ static int parse(void) playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); break; + case CON_STARTTRACKVAR: + insptr++; + music_select=(ud.volume_number*MAXLEVELS)+(GetGameVarID(*(insptr++), g_i, g_p)); + if (map[(unsigned char)music_select].musicfn != NULL) + playmusic(&map[(unsigned char)music_select].musicfn[0],music_select); + break; + case CON_GETTEXTURECEILING: insptr++; SetGameVarID(g_iTextureID, sector[g_sp->sectnum].ceilingpicnum, g_i, g_p); diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 327ad137f..15043f9e5 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -694,12 +694,14 @@ cvar[] = #if defined(POLYMOST) && defined(USE_OPENGL) { "r_anamorphic", "r_anamorphic: enable/disable widescreen mode", (void*)&glwidescreen, CVAR_BOOL, 0, 0, 1 }, { "r_projectionhack", "r_projectionhack: enable/disable projection hack", (void*)&glprojectionhacks, CVAR_BOOL, 0, 0, 1 }, +# ifdef POLYMER // polymer cvars { "pr_occlusionculling", "pr_occlusionculling: insert description that noone will ever read", (void*)&pr_occlusionculling, CVAR_INT, 0, 0, 512 }, { "pr_fov", "pr_fov: sets the field of vision in build angle", (void*)&pr_fov, CVAR_INT, 0, 0, 1023}, { "pr_billboardingmode", "pr_billboardingmode: face sprite display method. 0: classic mode; 1: polymost mode", (void*)&pr_billboardingmode, CVAR_INT, 0, 0, 1 }, { "pr_verbosity", "pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 0, 3 }, { "pr_wireframe", "pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_INT, 0, 0, 1 }, +#endif #endif { "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 0, 1 }, @@ -954,19 +956,19 @@ static int osdcmd_bind(const osdfuncparm_t *parm) if (parm->numparms==1&&!Bstrcasecmp(parm->parms[0],"showkeys")) { - for(i=0;keynames[i].name;i++)OSD_Printf("%s\n",keynames[i].name); + for (i=0;keynames[i].name;i++)OSD_Printf("%s\n",keynames[i].name); return OSDCMD_OK; } if (parm->numparms==0) { OSD_Printf("Keybindings:\n"); - for(i=0;inumparms < 2) return OSDCMD_SHOWHELP; - for(i=0;keynames[i].name;i++)if(!Bstrcasecmp(parm->parms[0],keynames[i].name))break; + for (i=0;keynames[i].name;i++)if (!Bstrcasecmp(parm->parms[0],keynames[i].name))break; if (!keynames[i].name) return OSDCMD_SHOWHELP; Bstrncpy(boundkeys[keynames[i].id].name,parm->parms[1], MAXSCRIPTFILENAMELENGTH-1); diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 835756bdc..7529c79df 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -213,9 +213,9 @@ void _playmusic(const char *fn) l = kfilelength(fp); MUSIC_StopSong(); Musicsize=0; - if(!MusicPtr) + if (!MusicPtr) MusicPtr=Bcalloc(1,l * sizeof(char)); - else MusicPtr=Brealloc(MusicPtr,l * sizeof(char)); + else MusicPtr=Brealloc(MusicPtr,l * sizeof(char)); Musicsize=l; kread(fp, (unsigned char *)MusicPtr, l); @@ -231,9 +231,9 @@ void _playmusic(const char *fn) int playmusic(const char *fn, const int sel) { Musicsize=0; - if(map[sel].musicfn1 != NULL) + if (map[sel].musicfn1 != NULL) _playmusic(map[sel].musicfn1); - if(!Musicsize) + if (!Musicsize) { _playmusic(fn); return 0; @@ -254,7 +254,7 @@ int loadsound(unsigned int num) return 0; } - if(g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,loadfromgrouponly); + if (g_sounds[num].filename1)fp = kopen4load(g_sounds[num].filename1,loadfromgrouponly); if (fp == -1)fp = kopen4load(g_sounds[num].filename,loadfromgrouponly); if (fp == -1) { @@ -404,22 +404,22 @@ int xyzsound(int num,int i,int x,int y,int z) voice = FX_PlayLoopedVOC(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); else - if (*g_sounds[num].ptr == 'O') - voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, - pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); - else - voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, - pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); + if (*g_sounds[num].ptr == 'O') + voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, + pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); + else + voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, + pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,num); } else { if (*g_sounds[num].ptr == 'C') voice = FX_PlayVOC3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); else - if (*g_sounds[num].ptr == 'O') - voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); - else - voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); + if (*g_sounds[num].ptr == 'O') + voice = FX_PlayOGG3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); + else + voice = FX_PlayWAV3D(g_sounds[ num ].ptr,pitch,sndang>>6,sndist>>6, g_sounds[num].pr, num); } if (voice > FX_Ok) @@ -487,22 +487,22 @@ void sound(int num) voice = FX_PlayLoopedOGG(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num); } - else - { - start = (int)*(unsigned short *)(g_sounds[num].ptr + 0x14); - voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, - pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num); - } + else + { + start = (int)*(unsigned short *)(g_sounds[num].ptr + 0x14); + voice = FX_PlayLoopedWAV(g_sounds[num].ptr, start, start + g_sounds[num].soundsiz, + pitch,LOUDESTVOLUME,LOUDESTVOLUME,LOUDESTVOLUME,g_sounds[num].pr,num); + } } else { if (*g_sounds[num].ptr == 'C') voice = FX_PlayVOC3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num); else - if (*g_sounds[num].ptr == 'O') - voice = FX_PlayOGG3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num); - else - voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num); + if (*g_sounds[num].ptr == 'O') + voice = FX_PlayOGG3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num); + else + voice = FX_PlayWAV3D(g_sounds[ num ].ptr, pitch,0,255-LOUDESTVOLUME,g_sounds[num].pr, num); } if (voice > FX_Ok) return; diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c index 7b57968fe..3b13357a1 100755 --- a/polymer/eduke32/source/startwin.game.c +++ b/polymer/eduke32/source/startwin.game.c @@ -88,7 +88,7 @@ static void PopulateForm(int pgs) Bsprintf(buf, "%d x %d %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp); j = ComboBox_AddString(hwnd, buf); (void)ComboBox_SetItemData(hwnd, j, i); - if (i == mode) (void)ComboBox_SetCurSel(hwnd, j); + if (i == mode)(void)ComboBox_SetCurSel(hwnd, j); } } @@ -144,7 +144,7 @@ static void PopulateForm(int pgs) Bsprintf(buf, "%s\t%s", grpfiles[i].name, fg->name); j = ListBox_AddString(hwnd, buf); (void)ListBox_SetItemData(hwnd, j, (LPARAM)fg); - if (!Bstrcasecmp(fg->name, settings.selectedgrp)) (void)ListBox_SetCurSel(hwnd, j); + if (!Bstrcasecmp(fg->name, settings.selectedgrp))(void)ListBox_SetCurSel(hwnd, j); } } }