diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index a8bb38057..889830da8 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -10842,7 +10842,7 @@ void draw2dscreen(long posxe, long posye, short ange, long zoome, short gride) char pointsize; col = 6; pointsize=2; - if (i == pointhighlight || ((wall[i].x == wall[pointhighlight].x) && (wall[i].y == wall[pointhighlight].y))) + if (i == pointhighlight || ((pointhighlight < MAXWALLS) && (wall[i].x == wall[pointhighlight].x) && (wall[i].y == wall[pointhighlight].y))) { if (totalclock & 16) { @@ -10887,7 +10887,7 @@ void draw2dscreen(long posxe, long posye, short ange, long zoome, short gride) } if (editstatus == 1) { - if (j+16384 == pointhighlight || ((sprite[j].x == sprite[pointhighlight-16384].x) && (sprite[j].y == sprite[pointhighlight-16384].y))) { + if (j+16384 == pointhighlight || ((pointhighlight-16384 < MAXSPRITES) && (sprite[j].x == sprite[pointhighlight-16384].x) && (sprite[j].y == sprite[pointhighlight-16384].y))) { if (totalclock & 32) col += (2<<2); } else if ((highlightcnt > 0) && (editstatus == 1)) diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index 4660b0874..bb1fff45f 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -2865,7 +2865,7 @@ static int SetupOpenGL(int width, int height, int bitspp) 0,0, width,height, hWindow, - (HMENU)1, + (HMENU)0, hInstance, NULL); if (!hGLWindow) { diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 14b7b9044..f6f344888 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -12108,6 +12108,7 @@ FRAGBONUS: { int yy = 0, zz; + getpackets(); handleevents(); AudioUpdate(); diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 4291fbd86..950f683dc 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -4508,15 +4508,18 @@ static int parse(void) { int distvar = *insptr++, xvar = GetGameVarID(*insptr++, g_i, g_p), yvar = GetGameVarID(*insptr++, g_i, g_p), distx=0; - switch (tw) + if (xvar > -1 && xvar < MAXSPRITES && yvar > -1 && yvar < MAXSPRITES) { - case CON_DIST: - distx = dist(&sprite[xvar],&sprite[yvar]); - break; - case CON_LDIST: - distx = ldist(&sprite[xvar],&sprite[yvar]); - break; - } + switch (tw) + { + case CON_DIST: + distx = dist(&sprite[xvar],&sprite[yvar]); + break; + case CON_LDIST: + distx = ldist(&sprite[xvar],&sprite[yvar]); + break; + } + } else OSD_Printf("error: invalid sprite\n"); SetGameVarID(distvar, distx, g_i, g_p); break; diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 7983e4d91..8ff2122a8 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -198,10 +198,11 @@ int checkcursectnums(int sect) long ldist(spritetype *s1,spritetype *s2) { - long vx,vy; + long vx,vy,ret; vx = s1->x - s2->x; vy = s1->y - s2->y; - return(FindDistance2D(vx,vy) + 1); + ret = FindDistance2D(vx,vy); + return(ret?ret:1); } long dist(spritetype *s1,spritetype *s2)