From ef3c5e6ad8d14fd68a014fd55163abb27be43285 Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 1 Sep 2008 07:15:16 +0000 Subject: [PATCH] A bunch of random shit git-svn-id: https://svn.eduke32.com/eduke32@1044 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/editor.h | 2 + polymer/build/src/build.c | 60 +++++++++++--- polymer/build/src/engine.c | 55 +++++++------ polymer/eduke32/source/actors.c | 8 +- polymer/eduke32/source/astub.c | 52 +++++++++++- polymer/eduke32/source/duke3d.h | 2 +- polymer/eduke32/source/gamedef.c | 131 +++++++++++++++++++++++++----- polymer/eduke32/source/gameexec.c | 24 +++++- polymer/eduke32/source/player.c | 64 +++++++-------- 9 files changed, 304 insertions(+), 94 deletions(-) diff --git a/polymer/build/include/editor.h b/polymer/build/include/editor.h index f97a4ef6e..ac86fc597 100644 --- a/polymer/build/include/editor.h +++ b/polymer/build/include/editor.h @@ -76,6 +76,8 @@ extern void ExtEditSpriteData(short spritenum); extern char ExtCustomSpriteColor(short picnum); extern void ExtSetupSpecialSpriteCols(void); +extern int circlewall; + int loadsetup(const char *fn); // from config.c int writesetup(const char *fn); // from config.c diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 428a24f97..3e3959eb6 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -2945,7 +2945,7 @@ void overheadeditor(void) short splitstartwall=0, splitendwall, loopnum; int mousx, mousy, bstatus; int centerx, centery, circlerad; - short circlewall, circlepoints, circleang1, circleang2, circleangdir; + short circlepoints, circleang1, circleang2, circleangdir; int sectorhighlightx=0, sectorhighlighty=0; short cursectorhighlight, sectorhighlightstat; short hitsect, hitwall, hitsprite; @@ -2971,17 +2971,17 @@ void overheadeditor(void) ydim16 = ydim; drawline16(0,ydim-STATUS2DSIZ,xdim-1,ydim-STATUS2DSIZ,1); - drawline16(0,ydim-1,xdim-1,ydim-1,1); +/* drawline16(0,ydim-1,xdim-1,ydim-1,1); drawline16(0,ydim-STATUS2DSIZ,0,ydim-1,1); drawline16(xdim-1,ydim-STATUS2DSIZ,xdim-1,ydim-1,1); drawline16(0,ydim-STATUS2DSIZ+24,xdim-1,ydim-STATUS2DSIZ+24,1); - drawline16(192-24,ydim-STATUS2DSIZ,192-24,ydim-STATUS2DSIZ+24,1); + drawline16(192-24,ydim-STATUS2DSIZ,192-24,ydim-STATUS2DSIZ+24,1); */ if (totalclock < 120*5) printext16(8L,ydim-STATUS2DSIZ+32L,9,-1,kensig,0); // printmessage16("Version: "VERSION); if (totalclock < 30) printmessage16("Press F1 for help"); - drawline16(0,ydim-1-20,xdim-1,ydim-1-20,1); +// drawline16(0,ydim-1-20,xdim-1,ydim-1-20,1); drawline16(256,ydim-1-20,256,ydim-1,1); ydim16 = ydim-STATUS2DSIZ; enddrawing(); //}}} @@ -3164,8 +3164,16 @@ void overheadeditor(void) y1 = midydim16+day-4; x2 = x1 + (Bstrlen(dabuffer)<<2)+2; y2 = y1 + 7; - if ((x1 >= 0) && (x2 < xdim) && (y1 >= 0) && (y2 < ydim16)) + if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16)) + { printext16(x1,y1,0,7,dabuffer,1); + drawline16(x1-1,y1-1,x2-3,y1-1,7); + drawline16(x1-1,y2+1,x2-3,y2+1,7); + + drawline16(x1-2,y1,x1-2,y2,7); + drawline16(x2-2,y1,x2-2,y2,7); + drawline16(x2-3,y1,x2-3,y2,7); + } } } @@ -3190,8 +3198,16 @@ void overheadeditor(void) y1 = midydim16+day-4; x2 = x1 + (Bstrlen(dabuffer)<<2)+2; y2 = y1 + 7; - if ((x1 >= 0) && (x2 < xdim) && (y1 >= 0) && (y2 < ydim16)) + if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16)) + { printext16(x1,y1,0,4,dabuffer,1); + drawline16(x1-1,y1-1,x2-3,y1-1,4); + drawline16(x1-1,y2+1,x2-3,y2+1,4); + + drawline16(x1-2,y1,x1-2,y2,4); + drawline16(x2-2,y1,x2-2,y2,4); + drawline16(x2-3,y1,x2-3,y2,4); + } } } } @@ -3215,7 +3231,7 @@ void overheadeditor(void) y1 = midydim16+day-4; x2 = x1 + (Bstrlen(dabuffer)<<2)+2; y2 = y1 + 7; - if ((x1 >= 0) && (x2 < xdim) && (y1 >= 0) && (y2 < ydim16)) + if ((x1 > 3) && (x2 < xdim) && (y1 > 1) && (y2 < ydim16)) { col = 3; if (spritecol2d[sprite[i].picnum][0]) @@ -3230,6 +3246,13 @@ void overheadeditor(void) if ((i == pointhighlight-16384) && (totalclock & 32)) col += (2<<2); printext16(x1,y1,0,col,dabuffer,1); + + drawline16(x1-1,y1-1,x2-3,y1-1,col); + drawline16(x1-1,y2+1,x2-3,y2+1,col); + + drawline16(x1-2,y1,x1-2,y2,col); + drawline16(x2-2,y1,x2-2,y2,col); + drawline16(x2-3,y1,x2-3,y2,col); } } j--; @@ -4861,6 +4884,8 @@ void overheadeditor(void) tempint2 = dmulscale4(y1-y2,x1-x3,y1-y3,x2-x1); if (tempint2 != 0) { + int pointsize = 2; + centerx = (((x1+x2) + scale(y1-y2,tempint1,tempint2))>>1); centery = (((y1+y2) + scale(x2-x1,tempint1,tempint2))>>1); @@ -4903,11 +4928,11 @@ void overheadeditor(void) } dax = mulscale14(dax-posx,zoom); day = mulscale14(day-posy,zoom); -/* drawline16(halfxdim16+dax-2,midydim16+day-2,halfxdim16+dax+2,midydim16+day-2,14); - drawline16(halfxdim16+dax+2,midydim16+day-2,halfxdim16+dax+2,midydim16+day+2,14); - drawline16(halfxdim16+dax+2,midydim16+day+2,halfxdim16+dax-2,midydim16+day+2,14); - drawline16(halfxdim16+dax-2,midydim16+day+2,halfxdim16+dax-2,midydim16+day-2,14); */ - drawcircle16(halfxdim16+dax, midydim16+day, 3, 14); + drawline16(halfxdim16+dax-pointsize,midydim16+day-pointsize,halfxdim16+dax+pointsize,midydim16+day-pointsize,14); + drawline16(halfxdim16+dax+pointsize,midydim16+day-pointsize,halfxdim16+dax+pointsize,midydim16+day+pointsize,14); + drawline16(halfxdim16+dax+pointsize,midydim16+day+pointsize,halfxdim16+dax-pointsize,midydim16+day+pointsize,14); + drawline16(halfxdim16+dax-pointsize,midydim16+day+pointsize,halfxdim16+dax-pointsize,midydim16+day-pointsize,14); +// drawcircle16(halfxdim16+dax, midydim16+day, 3, 14); } if (bad > 0) { @@ -5786,7 +5811,8 @@ CANCEL: if (keystatus[1]) { keystatus[1] = 0; - printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (Q)uit"); + printmessage16("(N)ew, (L)oad, (S)ave, save (A)s, (Q)uit,"); +// printext16(200L+248, ydim-STATUS2DSIZ+17L, 9, 0, "(U)ndo, (R)edo", 0); showframe(1); bflushchars(); bad = 1; @@ -7807,6 +7833,14 @@ void _printmessage16(const char *fmt, ...) snotbuf[54] = 0; begindrawing(); printext16(200L-24, ydim-STATUS2DSIZ+8L, 9, 0, snotbuf, 0); + i = 0; + while (i < 54) + { + snotbuf[i] = 32; + i++; + } + snotbuf[54] = 0; + printext16(200L-24, ydim-STATUS2DSIZ+17L, 9, 0, snotbuf, 0); enddrawing(); } diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 0e03066f3..88179b426 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -11045,7 +11045,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride) { if (xp1 != xp2) { - drawline16(xp1,yp1,xp1,yp2,8); + drawline16(xp1,yp1,xp1,yp2,25); } } } @@ -11053,7 +11053,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride) xp2 = xp1; if ((xp2 >= 0) && (xp2 < xdim)) { - drawline16(xp2,yp1,xp2,yp2,8); + drawline16(xp2,yp1,xp2,yp2,25); } } xp1 = mulscale14(posxe+editorgridextent,zoome); @@ -11066,7 +11066,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride) { if ((yp1 > midydim16-ydim16) && (yp1 <= midydim16)) { - drawline16(halfxdim16-xp1,midydim16-yp1,halfxdim16-xp2,midydim16-yp1,8); + drawline16(halfxdim16-xp1,midydim16-yp1,halfxdim16-xp2,midydim16-yp1,25); tempy = yp1; } } @@ -11082,6 +11082,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride) char spritecol2d[MAXTILES][2]; int showfirstwall=0; +int circlewall=-1; void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride) { @@ -11127,7 +11128,7 @@ void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride) } else { - col = 4; + col = 31; if ((wal->cstat&1) != 0) col = 5; if (wal->nextwall!=-1&&((wal->cstat^wall[wal->nextwall].cstat)&1)) col = 2; if ((i == linehighlight) || ((linehighlight >= 0) && (i == wall[linehighlight].nextwall))) @@ -11139,6 +11140,9 @@ void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride) if (i == linehighlight) if (totalclock & 16) col -= (2<<2); } + if (circlewall >= 0 && (i == circlewall || wal->nextwall == circlewall)) + col = 14; + xp1 = mulscale14(wal->x-posxe,zoome); yp1 = mulscale14(wal->y-posye,zoome); xp2 = mulscale14(wall[wal->point2].x-posxe,zoome); @@ -11182,29 +11186,29 @@ void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride) if (jj == ii) { - int dax3 = mulscale11(sintable[(k+1024)&2047],zoome) / 4096; - int day3 = mulscale11(sintable[(k+512)&2047],zoome) / 4096; - int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 4096; - int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 4096; + int dax3 = mulscale11(sintable[(k+1024)&2047],zoome) / 2560; + int day3 = mulscale11(sintable[(k+512)&2047],zoome) / 2560; + int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560; + int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560; drawline16(halfxdim16+dax+dax3,midydim16+day+day3,halfxdim16+dax+dax2,midydim16+day+day2,col); } else if (jj > ii) { - int dax2 = mulscale11(sintable[(k+1024)&2047],zoome) / 3072; - int day2 = mulscale11(sintable[(k+512)&2047],zoome) / 3072; + int dax2 = mulscale11(sintable[(k+1024)&2047],zoome) / 2560; + int day2 = mulscale11(sintable[(k+512)&2047],zoome) / 2560; drawline16(halfxdim16+dax,midydim16+day,halfxdim16+dax+dax2,midydim16+day+day2,col); } else { - int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 3072; - int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 3072; + int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560; + int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560; drawline16(halfxdim16+dax,midydim16+day,halfxdim16+dax+dax2,midydim16+day+day2,col); } } else { - int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 3072; - int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 3072; + int dax2 = mulscale11(sintable[(k+2048)&2047],zoome) / 2560; + int day2 = mulscale11(sintable[(k+1536)&2047],zoome) / 2560; drawline16(halfxdim16+dax,midydim16+day,halfxdim16+dax+dax2,midydim16+day+day2,col); } } @@ -11212,13 +11216,13 @@ void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride) if (((halfxdim16+xp1) >= 2) && ((halfxdim16+xp1) <= xdim-3)) if (((midydim16+yp1) >= 2) && ((midydim16+yp1) <= ydim16-3)) { - int pointsize = 3; - col = 6; + int pointsize = 1; + col = 15; if (i == pointhighlight || ((pointhighlight < MAXWALLS) && (pointhighlight >= 0) && (wall[i].x == wall[pointhighlight].x) && (wall[i].y == wall[pointhighlight].y))) { if (totalclock & 16) { - col += (2<<2); // JBF 20040116: two braces is all this needed. man I'm a fool sometimes. + //col += (2<<2); // JBF 20040116: two braces is all this needed. man I'm a fool sometimes. pointsize += 1; } } @@ -11227,17 +11231,22 @@ void draw2dscreen(int posxe, int posye, short ange, int zoome, short gride) if (show2dwall[i>>3]&pow2char[i&7]) if (totalclock & 16) { - col += (2<<2); // JBF 20040116: two braces is all this needed. man I'm a fool sometimes. + // col += (2<<2); // JBF 20040116: two braces is all this needed. man I'm a fool sometimes. pointsize += 1; } } tempint = ((midydim16+yp1)*bytesperline)+(halfxdim16+xp1)+frameplace; -#if 0 - drawline16(halfxdim16+xp1-pointsize,midydim16+yp1+pointsize,halfxdim16+xp1+pointsize,midydim16+yp1+pointsize,col); - drawline16(halfxdim16+xp1+pointsize,midydim16+yp1+pointsize,halfxdim16+xp1+pointsize,midydim16+yp1-pointsize,col); - drawline16(halfxdim16+xp1+pointsize,midydim16+yp1-pointsize,halfxdim16+xp1-pointsize,midydim16+yp1-pointsize,col); - drawline16(halfxdim16+xp1-pointsize,midydim16+yp1-pointsize,halfxdim16+xp1-pointsize,midydim16+yp1+pointsize,col); +#if 1 + do + { +/* drawline16(halfxdim16+xp1-pointsize,midydim16+yp1+pointsize,halfxdim16+xp1+pointsize,midydim16+yp1+pointsize,col); + drawline16(halfxdim16+xp1+pointsize,midydim16+yp1+pointsize,halfxdim16+xp1+pointsize,midydim16+yp1-pointsize,col); + drawline16(halfxdim16+xp1+pointsize,midydim16+yp1-pointsize,halfxdim16+xp1-pointsize,midydim16+yp1-pointsize,col); + drawline16(halfxdim16+xp1-pointsize,midydim16+yp1-pointsize,halfxdim16+xp1-pointsize,midydim16+yp1+pointsize,col); */ + drawcircle16(halfxdim16+xp1, midydim16+yp1, pointsize, col); + } + while (pointsize--); #else drawcircle16(halfxdim16+xp1, midydim16+yp1, pointsize, col); #endif diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 06f052a9e..462038084 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -495,17 +495,17 @@ int movesprite(int spritenum, int xchange, int ychange, int zchange, unsigned in if (dasectnum < 0 || (dasectnum >= 0 && ((hittype[spritenum].actorstayput >= 0 && hittype[spritenum].actorstayput != dasectnum) || ((sprite[spritenum].picnum == BOSS2) && sprite[spritenum].pal == 0 && sector[dasectnum].lotag != 3) || - ((sprite[spritenum].picnum == BOSS1 || sprite[spritenum].picnum == BOSS2) && sector[dasectnum].lotag == 1) || - (sector[dasectnum].lotag == 1 && (sprite[spritenum].picnum == LIZMAN || (sprite[spritenum].picnum == LIZTROOP && sprite[spritenum].zvel == 0))) + ((sprite[spritenum].picnum == BOSS1 || sprite[spritenum].picnum == BOSS2) && sector[dasectnum].lotag == 1) /*|| + (sector[dasectnum].lotag == 1 && (sprite[spritenum].picnum == LIZMAN || (sprite[spritenum].picnum == LIZTROOP && sprite[spritenum].zvel == 0)))*/ )) ) { sprite[spritenum].x = oldx; sprite[spritenum].y = oldy; - if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && sprite[spritenum].picnum == LIZMAN) +/* if (dasectnum >= 0 && sector[dasectnum].lotag == 1 && sprite[spritenum].picnum == LIZMAN) sprite[spritenum].ang = (TRAND&2047); else if ((hittype[spritenum].temp_data[0]&3) == 1 && sprite[spritenum].picnum != COMMANDER) - sprite[spritenum].ang = (TRAND&2047); + sprite[spritenum].ang = (TRAND&2047); */ setsprite(spritenum,oldx,oldy,sprite[spritenum].z); if (dasectnum < 0) dasectnum = 0; return (16384+dasectnum); diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 75ce2fa1f..14a09acd2 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -361,6 +361,7 @@ int tileInGroup(int group, int tilenum) const char *ExtGetSectorCaption(short sectnum) { static char tempbuf[1024]; + Bmemset(tempbuf,0,sizeof(tempbuf)); if (qsetmode != 200 && (!(onnames==1 || onnames==4 || onnames==7) || (onnames==8))) { tempbuf[0] = 0; @@ -454,6 +455,7 @@ const char *ExtGetSectorCaption(short sectnum) const char *ExtGetWallCaption(short wallnum) { static char tempbuf[1024]; + Bmemset(tempbuf,0,sizeof(tempbuf)); if (!(onnames==2 || onnames==4)) { tempbuf[0] = 0; @@ -476,6 +478,7 @@ const char *ExtGetWallCaption(short wallnum) const char *SectorEffectorText(short spritenum) { static char tempbuf[1024]; + Bmemset(tempbuf,0,sizeof(tempbuf)); switch (sprite[spritenum].lotag) { case 0: @@ -587,6 +590,8 @@ const char *SectorEffectorText(short spritenum) const char *ExtGetSpriteCaption(short spritenum) { static char tempbuf[1024]; + + Bmemset(tempbuf,0,sizeof(tempbuf)); if ((onnames!=5 && onnames!=6 &&(!(onnames==3 || onnames==4 || onnames==7 || onnames==8))) || (onnames==7 && sprite[spritenum].picnum!=1)) { tempbuf[0] = 0; @@ -6362,7 +6367,9 @@ static void Keys2d(void) } if (autogrid) { - grid = scale(zoom,6,3072); + grid = zoom+512; + if (grid > 16384) grid = 16384; + grid = scale(grid,6,6144); if (grid > 7) grid = 7; if (grid < 0) grid = 0; } @@ -6526,6 +6533,25 @@ static void InitCustomColors(void) vgapal16[32*4+0] = 60; vgapal16[32*4+1] = 50; vgapal16[32*4+2] = 21; + + // grid color + vgapal16[25*4+0] = 19; + vgapal16[25*4+1] = 17; + vgapal16[25*4+2] = 17; + + vgapal16[26*4+0] = 24; + vgapal16[26*4+1] = 24; + vgapal16[26*4+2] = 24; + + vgapal16[33*4+0] = 15; // blue + vgapal16[33*4+1] = 30; // green + vgapal16[33*4+2] = 45; // red + + vgapal16[41*4+0] = 24; + vgapal16[41*4+1] = 40; + vgapal16[41*4+2] = 48; + + } void ExtPreSaveMap(void) @@ -9417,3 +9443,27 @@ static void FuncMenu(void) showframe(1); keystatus[KEYSC_ESC] = 0; } +/* +#define UNDODEPTH 96 + +typedef struct +{ + int numsectors; + int numwalls; + int numsprites; + + sectortype *sectors; + walltype *walls; + spritetype *sprites; + + short *headspritesect; + short *prevspritesect; + short *nextspritesect; + + short *headspritestat; + short *prevspritestat; + short *nextspritestat; +} mapundo_t; + +mapundo_t undoredo[UNDODEPTH]; +*/ \ No newline at end of file diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 0c44d879b..a30a32fe7 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //------------------------------------------------------------------------- // this is checked against http://eduke32.com/VERSION -#define BUILDDATE " 20080828" +#define BUILDDATE " 20080831" #define APPNAME "EDuke32" #define VERSION " 1.5.0devel" #define HEAD2 APPNAME VERSION BUILDDATE diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 968656208..6116e038d 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1684,6 +1684,7 @@ static void transvartype(int type) { ReportError(-1); initprintf("%s:%d: warning: found local gamevar `%s' used within %s; expect multiplayer synchronization issues.\n",compilefile,line_number,label+(labelcnt<<6),parsing_event?"a synced event":"an actor"); + warning++; } if (!(error || warning) && g_ScriptDebug > 1) initprintf("%s:%d: debug: accepted gamevar `%s'.\n",compilefile,line_number,label+(labelcnt<<6)); @@ -1765,6 +1766,7 @@ static int transnum(int type) gl = (char *)translatelabeltype(labeltype[i]); ReportError(-1); initprintf("%s:%d: warning: expected a %s, found a %s.\n",compilefile,line_number,el,gl); + warning++; Bfree(el); Bfree(gl); return -1; // valid label name, but wrong type @@ -1781,7 +1783,7 @@ static int transnum(int type) if (isdigit(*textptr) && labelsonly) { ReportError(WARNING_LABELSONLY); - // warning++; + warning++; } if (!(error || warning) && g_ScriptDebug > 1) initprintf("%s:%d: debug: accepted constant %d.\n",compilefile,line_number,atol(textptr)); @@ -1845,7 +1847,7 @@ static int parsecommand(void) exit(0); } - if ((error+warning) > 63 || (*textptr == '\0') || (*(textptr+1) == '\0')) return 1; + if (error > 63 || (*textptr == '\0') || (*(textptr+1) == '\0')) return 1; if (g_ScriptDebug) ReportError(-1); @@ -1894,7 +1896,7 @@ static int parsecommand(void) i = HASH_find(&gamevarH,label+(labelcnt<<6)); if (i>=0) { -// warning++; + warning++; ReportError(WARNING_NAMEMATCHESVAR); } @@ -1917,6 +1919,7 @@ static int parsecommand(void) char *gl = (char *)translatelabeltype(labeltype[j]); ReportError(-1); initprintf("%s:%d: warning: expected a state, found a %s.\n",compilefile,line_number,gl); + warning++; Bfree(gl); *(scriptptr-1) = CON_NULLOP; // get rid of the state, leaving a nullop to satisfy if conditions bitptr[(scriptptr-script-1)] = BITPTR_DONTFUCKWITHIT; @@ -2117,7 +2120,7 @@ static int parsecommand(void) i = HASH_find(&gamevarH,label+(labelcnt<<6)); if (i>=0) { -// warning++; + warning++; ReportError(WARNING_NAMEMATCHESVAR); } @@ -2145,18 +2148,18 @@ static int parsecommand(void) i = HASH_find(&gamevarH,label+(labelcnt<<6)); if (i>=0) { -// warning++; + warning++; ReportError(WARNING_NAMEMATCHESVAR); } i = HASH_find(&labelH,label+(labelcnt<<6)); if (i>=0) { - if (i >= defaultlabelcnt) +/* if (i >= defaultlabelcnt) { warning++; ReportError(WARNING_DUPLICATEDEFINITION); - } + } */ } //printf("Translating. '%.20s'\n",textptr); @@ -2165,7 +2168,7 @@ static int parsecommand(void) if (i == -1) { // printf("Defining Definition '%s' to be '%d'\n",label+(labelcnt<<6),*(scriptptr-1)); - HASH_add(&labelH,label+(labelcnt<<6),labelcnt); + HASH_replace(&labelH,label+(labelcnt<<6),labelcnt); labeltype[labelcnt] = LABEL_DEFINE; labelcode[labelcnt++] = *(scriptptr-1); if (*(scriptptr-1) >= 0 && *(scriptptr-1) < MAXTILES && dynamicremap) @@ -2196,7 +2199,10 @@ static int parsecommand(void) if (parsing_actor || parsing_state) { if (!CheckEventSync(current_event)) + { + warning++; ReportError(WARNING_EVENTSYNC); + } if ((transnum(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(scriptptr-1) != 0) && (*(scriptptr-1) != 1)) { @@ -2204,6 +2210,7 @@ static int parsecommand(void) bitptr[(scriptptr-script-1)] = BITPTR_DONTFUCKWITHIT; *(scriptptr-1) = 0; initprintf("%s:%d: warning: expected a move, found a constant.\n",compilefile,line_number); + warning++; } j = 0; @@ -2234,7 +2241,7 @@ static int parsecommand(void) i = HASH_find(&gamevarH,label+(labelcnt<<6)); if (i>=0) { -// warning++; + warning++; ReportError(WARNING_NAMEMATCHESVAR); } @@ -2415,7 +2422,10 @@ static int parsecommand(void) if (parsing_actor || parsing_state) { if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } transnum(LABEL_AI); } else @@ -2433,7 +2443,7 @@ static int parsecommand(void) i = HASH_find(&gamevarH,label+(labelcnt<<6)); if (i>=0) { -// warning++; + warning++; ReportError(WARNING_NAMEMATCHESVAR); } @@ -2464,6 +2474,7 @@ static int parsecommand(void) bitptr[(scriptptr-script-1)] = BITPTR_DONTFUCKWITHIT; *(scriptptr-1) = 0; initprintf("%s:%d: warning: expected a move, found a constant.\n",compilefile,line_number); + warning++; } k = 0; while (keyword() == -1) @@ -2491,7 +2502,10 @@ static int parsecommand(void) if (parsing_actor || parsing_state) { if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } transnum(LABEL_ACTION); } else @@ -2510,7 +2524,7 @@ static int parsecommand(void) i = HASH_find(&gamevarH,label+(labelcnt<<6)); if (i>=0) { -// warning++; + warning++; ReportError(WARNING_NAMEMATCHESVAR); } @@ -2611,6 +2625,7 @@ static int parsecommand(void) bitptr[(scriptptr-script-1)] = BITPTR_DONTFUCKWITHIT; *(scriptptr-1) = 0; initprintf("%s:%d: warning: expected a move, found a constant.\n",compilefile,line_number); + warning++; } break; } @@ -2666,6 +2681,7 @@ static int parsecommand(void) ReportError(-1); parsing_event = parsing_actor = tempscrptr; initprintf("%s:%d: warning: duplicate event `%s'.\n",compilefile,line_number,parsing_item_name); + warning++; } else apScriptGameEvent[j]=parsing_event; @@ -2728,6 +2744,7 @@ static int parsecommand(void) { ReportError(-1); initprintf("%s:%d: warning: invalid useractor type.\n",compilefile,line_number); + warning++; j = 0; } @@ -2780,6 +2797,7 @@ static int parsecommand(void) bitptr[(scriptptr-script-1)] = BITPTR_DONTFUCKWITHIT; *(scriptptr-1) = 0; initprintf("%s:%d: warning: expected a move, found a constant.\n",compilefile,line_number); + warning++; } break; } @@ -2795,7 +2813,10 @@ static int parsecommand(void) case CON_INSERTSPRITEQ: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } return 0; case CON_QSPRINTF: @@ -2842,7 +2863,10 @@ static int parsecommand(void) case CON_LOTSOFGLASS: case CON_SAVE: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_ANGOFF: case CON_QUOTE: case CON_SOUND: @@ -2857,6 +2881,7 @@ static int parsecommand(void) *(scriptptr-1) = 32768; ReportError(-1); initprintf("%s:%d: warning: tried to set cstat 32767, using 32768 instead.\n",compilefile,line_number); + warning++; } else if ((*(scriptptr-1) & 32) && (*(scriptptr-1) & 16)) { @@ -2864,13 +2889,17 @@ static int parsecommand(void) *(scriptptr-1) ^= 48; ReportError(-1); initprintf("%s:%d: warning: tried to set cstat %d, using %d instead.\n",compilefile,line_number,i,*(scriptptr-1)); + warning++; } } return 0; case CON_HITRADIUSVAR: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } transmultvars(5); break; case CON_HITRADIUS: @@ -2885,7 +2914,10 @@ static int parsecommand(void) case CON_ADDINVENTORY: case CON_GUTS: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } transnum(LABEL_DEFINE); transnum(LABEL_DEFINE); break; @@ -2914,7 +2946,10 @@ static int parsecommand(void) case CON_SETSECTOR: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_GETSECTOR: { int lLabelID; @@ -3046,7 +3081,10 @@ static int parsecommand(void) case CON_SETWALL: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_GETWALL: { int lLabelID; @@ -3110,7 +3148,10 @@ static int parsecommand(void) case CON_SETPLAYER: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_GETPLAYER: { int lLabelID; @@ -3188,7 +3229,10 @@ static int parsecommand(void) case CON_SETINPUT: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_GETINPUT: { int lLabelID; @@ -3304,7 +3348,10 @@ static int parsecommand(void) case CON_SETACTORVAR: case CON_SETPLAYERVAR: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_GETACTORVAR: case CON_GETPLAYERVAR: { @@ -3438,7 +3485,10 @@ static int parsecommand(void) case CON_SETACTOR: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_GETACTOR: { int lLabelID; @@ -3523,6 +3573,7 @@ static int parsecommand(void) { ReportError(-1); initprintf("%s:%d: warning: found `%s' outside of EVENT_ANIMATESPRITES\n",compilefile,line_number,tempbuf); + warning++; } // syntax getwall[].x @@ -3587,7 +3638,10 @@ static int parsecommand(void) case CON_GETTICKS: if (CheckEventSync(current_event)) + { ReportError(WARNING_REVEVENTSYNC); + warning++; + } case CON_GETCURRADDRESS: transvartype(GAMEVAR_FLAG_READONLY); return 0; @@ -3605,7 +3659,10 @@ static int parsecommand(void) case CON_SHOOTVAR: case CON_QUAKE: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_JUMP: case CON_CMENU: case CON_SOUNDVAR: @@ -3644,7 +3701,11 @@ static int parsecommand(void) case CON_DYNAMICREMAP: { scriptptr--; - if (dynamicremap++) initprintf("%s:%d: warning: duplicate dynamicremap statement\n",compilefile,line_number); + if (dynamicremap++) + { + initprintf("%s:%d: warning: duplicate dynamicremap statement\n",compilefile,line_number); + warning++; + } else initprintf("Using dynamic tile remapping\n"); break; } @@ -3653,7 +3714,10 @@ static int parsecommand(void) case CON_ZSHOOT: case CON_EZSHOOT: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_SETVAR: case CON_ADDVAR: case CON_SUBVAR: @@ -3723,7 +3787,10 @@ static int parsecommand(void) return 0; case CON_RANDVARVAR: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_SETVARVAR: case CON_ADDVARVAR: case CON_SUBVARVAR: @@ -3747,7 +3814,10 @@ static int parsecommand(void) case CON_OPERATEACTIVATORS: case CON_SSP: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_GMAXAMMO: case CON_DIST: case CON_LDIST: @@ -3859,7 +3929,10 @@ static int parsecommand(void) return 0; } if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } transvar(); return 0; } @@ -4064,7 +4137,10 @@ static int parsecommand(void) case CON_MOVESPRITE: case CON_SETSPRITE: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } transmultvars(4); if (tw == CON_MOVESPRITE) { @@ -4294,7 +4370,7 @@ repeatcase: for (i=(casecount/2)-1;i>=0;i--) if (casescriptptr[i*2+1]==j) { - //warning++; + warning++; ReportError(WARNING_DUPLICATECASE); break; } @@ -4382,7 +4458,10 @@ repeatcase: case CON_ZSHOOTVAR: case CON_EZSHOOTVAR: if (!CheckEventSync(current_event)) + { + warning++; ReportError(WARNING_EVENTSYNC); + } case CON_GETPNAME: case CON_STARTLEVEL: case CON_QSTRCAT: @@ -4403,7 +4482,10 @@ repeatcase: case CON_SETACTORANGLE: case CON_SETPLAYERANGLE: if (!CheckEventSync(current_event)) + { + warning++; ReportError(WARNING_EVENTSYNC); + } case CON_GETANGLETOTARGET: case CON_GETACTORANGLE: case CON_GETPLAYERANGLE: @@ -4424,7 +4506,10 @@ repeatcase: case CON_IFPINVENTORY: case CON_IFRND: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_IFPDISTL: case CON_IFPDISTG: case CON_IFWASWEAPON: @@ -4459,6 +4544,7 @@ repeatcase: ReportError(-1); *(scriptptr-1) = 0; initprintf("%s:%d: warning: expected a move, found a constant.\n",compilefile,line_number); + warning++; } break; case CON_IFPINVENTORY: @@ -4467,7 +4553,10 @@ repeatcase: break; case CON_IFSOUND: if (CheckEventSync(current_event)) + { ReportError(WARNING_REVEVENTSYNC); + warning++; + } default: transnum(LABEL_DEFINE); break; @@ -4617,13 +4706,14 @@ repeatcase: if (*textptr == '/' || *textptr == ' ') { initprintf("%s:%d: warning: invalid character in function name.\n",compilefile,line_number); + warning++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } if (i >= MAXGAMEFUNCLEN-1) { - initprintf("%s:%d: warning: function name exceeds limit of %d characters.\n",compilefile,line_number,MAXGAMEFUNCLEN); -// error++; + initprintf("%s:%d: warning: function name exceeds limit of %d characters, truncating.\n",compilefile,line_number,MAXGAMEFUNCLEN); + warning++; while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++; break; } @@ -5152,7 +5242,10 @@ repeatcase: case CON_MIKESND: case CON_TOSSWEAPON: if (!CheckEventSync(current_event)) + { ReportError(WARNING_EVENTSYNC); + warning++; + } case CON_NULLOP: case CON_STOPALLSOUNDS: return 0; @@ -5263,8 +5356,8 @@ static void passone(void) { while (parsecommand() == 0); - if ((error+warning) > 63) - initprintf("fatal error: too many warnings or errors: Aborted\n"); + if (error > 63) + initprintf("fatal error: too many errors: Aborted\n"); #ifdef DEBUG { @@ -5582,7 +5675,7 @@ void loadefs(const char *filenam) if (warning|error) initprintf("Found %d warning(s), %d error(s).\n",warning,error); - if (error == 0 && warning != 0) +/* if (error == 0 && warning != 0) { if (groupfile != -1 && loadfromgrouponly == 0) { @@ -5598,7 +5691,7 @@ void loadefs(const char *filenam) return; } } - } + } */ if (error) { diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 4b239ee1c..3680148b2 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -5046,7 +5046,7 @@ static int parse(void) hittype[g_i].extra = 1; g_sp->zvel = 0; } - else if (g_sp->zvel > 2048 && sector[g_sp->sectnum].lotag != 1) + else if (g_sp->zvel > 2048 /* && sector[g_sp->sectnum].lotag != 1*/) { j = g_sp->sectnum; pushmove(&g_sp->x,&g_sp->y,&g_sp->z,(short*)&j,128L,(4L<<8),(4L<<8),CLIPMASK0); @@ -5065,9 +5065,18 @@ static int parse(void) } else if (sector[g_sp->sectnum].lotag == 1) { + intptr_t *moveptr = (intptr_t *)g_t[1]; switch (dynamictostatic[g_sp->picnum]) { default: + // fix for flying/jumping monsters getting stuck in water + if (g_sp->statnum != MAXSTATUS && actorscrptr[g_sp->picnum] && + ((moveptr && *(moveptr+1)) || g_sp->hitag & jumptoplayer)) + { +// OSD_Printf("%d\n",*(moveptr+1)); + break; + } +// OSD_Printf("hitag: %d\n",g_sp->hitag); g_sp->z += (24<<8); case OCTABRAIN__STATIC: case COMMANDER__STATIC: @@ -5583,6 +5592,19 @@ static int parse(void) case CON_CHANGESPRITESTAT: if ((i<0 || i>=MAXSPRITES) && checkCON) {OSD_Printf(CON_ERROR "Invalid sprite %d\n",line_num,keyw[g_tw],i);break;} if ((j<0 || j>=MAXSTATUS) && checkCON) {OSD_Printf(CON_ERROR "Invalid status %d\n",line_num,keyw[g_tw],j);break;} + /* initialize actor pointers when changing to an actor statnum because they usually + have garbage left over from being handled as a hard coded object */ + if ((j == 1 || j == 2) && actorscrptr[sprite[i].picnum]) + { + T5 = *(actorscrptr[sprite[i].picnum]+1); + T2 = *(actorscrptr[sprite[i].picnum]+2); + sprite[i].hitag = *(actorscrptr[sprite[i].picnum]+3); + } + else + { + T2=T5=0; + sprite[i].hitag = 0; + } changespritestat(i,j); break; case CON_CHANGESPRITESECT: diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index d674797db..22ca85254 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -42,6 +42,7 @@ int32 lastcontroltime; //MED void setpal(player_struct *p) { if (p->heat_on) p->palette = slimepal; + else if (p->cursectnum < 0) p->palette = palette; else if ((sector[p->cursectnum].ceilingpicnum >= FLOORSLIME)&&(sector[p->cursectnum].ceilingpicnum <=FLOORSLIME+2)) { p->palette = slimepal; @@ -50,7 +51,6 @@ void setpal(player_struct *p) { if (sector[p->cursectnum].lotag == 2) p->palette = waterpal; else p->palette = palette; - } restorepalette = 1; } @@ -502,7 +502,7 @@ int shoot(int i,int atwith) hittype[k].temp_data[7] = hitsect; hittype[k].temp_data[8] = hitspr; } - if (projectile[atwith].sound > -1) spritesound(projectile[atwith].sound,j); + if (projectile[atwith].sound >= 0) spritesound(projectile[atwith].sound,j); } if (p >= 0 && g_player[p].ps->steroids_amount > 0 && g_player[p].ps->steroids_amount < 400) @@ -650,7 +650,7 @@ int shoot(int i,int atwith) if ((projectile[atwith].range > 0) && ((klabs(sx-hitx)+klabs(sy-hity)) > projectile[atwith].range)) return -1; - if (projectile[atwith].trail > -1) + if (projectile[atwith].trail >= 0) hitscantrail(sx,sy,sz,hitx,hity,hitz,sa,atwith); if (projectile[atwith].workslike & PROJECTILE_FLAG_WATERBUBBLES) @@ -898,7 +898,7 @@ DOSKIPBULLETHOLE: } // else zvel = (100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*81; else zvel = ((100-g_player[p].ps->horiz-g_player[p].ps->horizoff)*(projectile[atwith].vel/8)); - if (projectile[atwith].sound > -1) spritesound(projectile[atwith].sound,i); + if (projectile[atwith].sound >= 0) spritesound(projectile[atwith].sound,i); } else { @@ -1908,8 +1908,9 @@ static int animatefist(int gs,int snum) if (sprite[g_player[snum].ps->i].pal == 1) fistpal = 1; - else + else if (g_player[snum].ps->cursectnum >= 0) fistpal = sector[g_player[snum].ps->cursectnum].floorpal; + else fistpal = 0; rotatesprite( (-fisti+222+(g_player[snum].sync->avel>>4))<<16, @@ -1922,7 +1923,7 @@ static int animatefist(int gs,int snum) static int animateknee(int gs,int snum) { static signed char knee_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8}; - int looking_arc, pal; + int looking_arc, pal = g_player[snum].ps->palookup; if (g_player[snum].ps->knee_incs > 11 || g_player[snum].ps->knee_incs == 0 || sprite[g_player[snum].ps->i].extra <= 0) return 0; @@ -1932,7 +1933,7 @@ static int animateknee(int gs,int snum) if (sprite[g_player[snum].ps->i].pal == 1) pal = 1; - else + else if (g_player[snum].ps->cursectnum >= 0) { pal = sector[g_player[snum].ps->cursectnum].floorpal; if (pal == 0) @@ -1947,7 +1948,7 @@ static int animateknee(int gs,int snum) static int animateknuckles(int gs,int snum) { static char knuckle_frames[] = {0,1,2,2,3,3,3,2,2,1,0}; - int looking_arc, pal; + int looking_arc, pal = 0; if (g_player[snum].ps->knuckle_incs == 0 || sprite[g_player[snum].ps->i].extra <= 0) return 0; @@ -1957,7 +1958,7 @@ static int animateknuckles(int gs,int snum) if (sprite[g_player[snum].ps->i].pal == 1) pal = 1; - else + else if (g_player[snum].ps->cursectnum >= 0) pal = sector[g_player[snum].ps->cursectnum].floorpal; myospal(160+(g_player[snum].sync->avel>>4)-(g_player[snum].ps->look_ang>>1),looking_arc+180-((g_player[snum].ps->horiz-g_player[snum].ps->horizoff)>>4),CRACKKNUCKLES+knuckle_frames[g_player[snum].ps->knuckle_incs>>1],gs,4,pal); @@ -2053,7 +2054,7 @@ void displaymasks(int snum) if (sprite[g_player[snum].ps->i].pal == 1) p = 1; - else if (g_player[snum].ps->cursectnum > -1) + else if (g_player[snum].ps->cursectnum >= 0) p = sector[g_player[snum].ps->cursectnum].floorpal; else p = 0; @@ -2205,7 +2206,7 @@ void displayweapon(int snum) pal = 1; else { - if (p->cursectnum > -1) + if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; if (pal == 0) pal = p->palookup; @@ -2254,7 +2255,7 @@ void displayweapon(int snum) pal = 1; else { - if (p->cursectnum > -1) + if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; if (pal == 0) pal = p->palookup; @@ -2278,7 +2279,7 @@ void displayweapon(int snum) { if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2308,7 +2309,7 @@ void displayweapon(int snum) { if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2337,7 +2338,7 @@ void displayweapon(int snum) { if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2423,7 +2424,7 @@ void displayweapon(int snum) { if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2474,7 +2475,7 @@ void displayweapon(int snum) { if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2529,7 +2530,7 @@ void displayweapon(int snum) { if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2566,7 +2567,7 @@ void displayweapon(int snum) static char remote_frames[] = {0,1,1,2,1,1,0,0,0,0,0}; if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2587,7 +2588,7 @@ void displayweapon(int snum) { if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2624,7 +2625,7 @@ void displayweapon(int snum) { if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; @@ -2655,7 +2656,7 @@ void displayweapon(int snum) looking_arc += 18; if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; { @@ -2698,7 +2699,7 @@ void displayweapon(int snum) looking_arc += 18; if (sprite[p->i].pal == 1) pal = 1; - else if (p->cursectnum > -1) + else if (p->cursectnum >= 0) pal = sector[p->cursectnum].floorpal; else pal = 0; if (((*kb) > 0) && ((*kb) < aplWeaponTotalTime[p->curr_weapon][snum])) @@ -3207,7 +3208,7 @@ static int doincrements(player_struct *p) } } - if (p->cursectnum > -1 && p->scuba_on == 0 && sector[p->cursectnum].lotag == 2) + if (p->cursectnum >= 0 && p->scuba_on == 0 && sector[p->cursectnum].lotag == 2) { if (p->scuba_amount > 0) { @@ -3335,11 +3336,10 @@ void processinput(int snum) truefdist = klabs(p->posz-j); - /* wtf is this supposed to do? + /* wtf is this supposed to do? */ if ((lz&49152) == 16384 && psectlotag == 1 && truefdist > PHEIGHT+(16<<8)) psectlotag = 0; - */ - + hittype[pi].floorz = fz; hittype[pi].ceilingz = cz; @@ -4006,7 +4006,7 @@ void processinput(int snum) else { if (p->footprintcount > 0 && p->on_ground) - if (p->cursectnum > -1 && (sector[p->cursectnum].floorstat&2) != 2) + if (p->cursectnum >= 0 && (sector[p->cursectnum].floorstat&2) != 2) { for (j=headspritesect[psect];j>=0;j=nextspritesect[j]) if (sprite[j].picnum == FOOTPRINTS || sprite[j].picnum == FOOTPRINTS2 || sprite[j].picnum == FOOTPRINTS3 || sprite[j].picnum == FOOTPRINTS4) @@ -4016,7 +4016,7 @@ void processinput(int snum) if (j < 0) { p->footprintcount--; - if (p->cursectnum > -1 && sector[p->cursectnum].lotag == 0 && sector[p->cursectnum].hitag == 0) + if (p->cursectnum >= 0 && sector[p->cursectnum].lotag == 0 && sector[p->cursectnum].hitag == 0) { switch (TRAND&3) { @@ -4059,7 +4059,7 @@ void processinput(int snum) } if ((p->posz+p->poszv) >= (fz-(i<<8)) && p->cursectnum >= 0) // hit the ground - if (psectlotag != 1) + if (sector[p->cursectnum].lotag != 1) { if (p->falling_counter > 62) quickkill(p); @@ -4422,7 +4422,7 @@ HORIZONLY: if (psectlotag == 1 || p->spritebridge == 1) i = (4L<<8); else i = (20L<<8); - if (p->cursectnum > -1 && sector[p->cursectnum].lotag == 2) k = 0; + if (p->cursectnum >= 0 && sector[p->cursectnum].lotag == 2) k = 0; else k = 1; if (ud.clipping) @@ -4476,7 +4476,7 @@ HORIZONLY: } } - if (p->cursectnum > -1 && truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1) + if (p->cursectnum >= 0 && truefdist < PHEIGHT && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1) if (!isspritemakingsound(pi,DUKE_ONWATER)) spritesound(DUKE_ONWATER,pi);