From d3c3b7f0e79905c9917ca35c6a24cd6eff9b6ac0 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 24 Aug 2008 09:29:03 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1019 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/osd.c | 15 ++++----- polymer/eduke32/source/game.c | 57 +++++++++++++-------------------- polymer/eduke32/source/sector.c | 16 ++++----- 3 files changed, 37 insertions(+), 51 deletions(-) diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index 4d43b1459..e32c466b8 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -1446,20 +1446,17 @@ void OSD_Printf(const char *fmt, ...) if (isdigit(*(chp+1))) { char smallbuf[4]; - chp++; - if (isdigit(*(chp+1))) - { - smallbuf[0] = *(chp++); - smallbuf[1] = *(chp); - smallbuf[2] = '\0'; - p = atol(smallbuf); - } - else + if (!isdigit(*(++chp+1))) { smallbuf[0] = *(chp); smallbuf[1] = '\0'; p = atol(smallbuf); + continue; } + smallbuf[0] = *(chp++); + smallbuf[1] = *(chp); + smallbuf[2] = '\0'; + p = atol(smallbuf); continue; } if (Btoupper(*(chp+1)) == 'S') diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 1032d245c..ab8cb8b6e 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -293,11 +293,11 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i if (centre) { - while (*t) + do { if (*t == '^' && isdigit(*(t+1))) { - t += 2; + t++; if (isdigit(*t)) t++; continue; } @@ -307,7 +307,6 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i newx+=(8-squishtext)*z/65536; else newx+=(5-squishtext)*z/65536; - t++; continue; } else ac = *t - '!' + starttile; @@ -322,8 +321,8 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i newx += (8-squishtext)*z/65536; else newx += (tilesizx[ac]-squishtext)*z/65536; } - t++; } + while (*(++t)); t = oldt; x = (widthx>>1)-((orientation & 256)?newx<<15:newx>>1); @@ -331,25 +330,22 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i // usehightile = (ht && r_downsize < 2); ox=x; oy=y; - while (*t) + do { if (*t == '^' && isdigit(*(t+1))) { char smallbuf[4]; - t++; - if (isdigit(*(t+1))) + if (!isdigit(*(++t+1))) { - smallbuf[0] = *(t++); - smallbuf[1] = *(t++); - smallbuf[2] = '\0'; - p = atol(smallbuf); - } - else - { - smallbuf[0] = *(t++); + smallbuf[0] = *(t); smallbuf[1] = '\0'; p = atol(smallbuf); + continue; } + smallbuf[0] = *(t++); + smallbuf[1] = *(t); + smallbuf[2] = '\0'; + p = atol(smallbuf); continue; } if (*t == 32) @@ -358,7 +354,6 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i x+=(8-squishtext)*z/65536; else x+=(5-squishtext)*z/65536; - t++; continue; } else ac = *t - '!' + starttile; @@ -382,8 +377,8 @@ int gametext_z(int small, int starttile, int x,int y,const char *t,int s,int p,i if ((orientation&256) == 0) // warpping long strings doesn't work for precise coordinates due to overflow if (x > (ud.config.ScreenWidth - 14)) oldt = (char *)t, x = oldx, y+=8*z/65536; - t++; } + while (*(++t)); // usehightile = ht; return (x); } @@ -395,12 +390,11 @@ int gametextlen(int x,const char *t) if (t == NULL) return -1; - while (*t) + do { if (*t == 32) { x+=5; - t++; continue; } else ac = *t - '!' + STARTALPHANUM; @@ -411,9 +405,8 @@ int gametextlen(int x,const char *t) if ((*t >= '0' && *t <= '9')) x += 8; else x += tilesizx[ac]; - t++; } - + while (*(++t)); return (x); } @@ -434,32 +427,28 @@ int minitext_(int x,int y,const char *t,int s,int p,int sb) sb &= 255; // usehightile = (ht && !r_downsize); - while (*t) + do { if (*t == '^' && isdigit(*(t+1))) { char smallbuf[4]; - t++; - if (isdigit(*(t+1))) + if (!isdigit(*(++t+1))) { - smallbuf[0] = *(t++); - smallbuf[1] = *(t++); - smallbuf[2] = '\0'; - p = atol(smallbuf); - } - else - { - smallbuf[0] = *(t++); + smallbuf[0] = *(t); smallbuf[1] = '\0'; p = atol(smallbuf); + continue; } + smallbuf[0] = *(t++); + smallbuf[1] = *(t); + smallbuf[2] = '\0'; + p = atol(smallbuf); continue; } ch = Btoupper(*t); if (ch == 32) { x+=5; - t++; continue; } else ac = ch - '!' + MINIFONT; @@ -468,8 +457,8 @@ int minitext_(int x,int y,const char *t,int s,int p,int sb) else rotatesprite(x<<16,y<<16,65536L,0,ac,s,p,sb,0,0,xdim-1,ydim-1); x += 4; // tilesizx[ac]+1; - t++; } + while (*(++t)); // usehightile = ht; return (x); } diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 052c5dea0..c60427ba0 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -1341,7 +1341,7 @@ int checkhitswitch(int snum,int w,int switchtype) i = nextspritestat[i]; } - for (i=0;i=0;i--) { x = i; if (lotag == wall[x].lotag) @@ -2094,7 +2094,7 @@ void checkhitsprite(int i,int sn) case CACTUS__STATIC: { if (rpg == 1) - for (k=0;k<64;k++) + for (k=64;k>0;k--) { j = EGS(SECT,SX,SY,SZ-(TRAND%(48<<8)),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); sprite[j].pal = 8; @@ -2107,7 +2107,7 @@ void checkhitsprite(int i,int sn) case FIRELASER__STATIC: case HYDRENT__STATIC: case HEAVYHBOMB__STATIC: - for (k=0;k<64;k++) + for (k=64;k>0;k--) { j = EGS(SECT,SX,SY,SZ-(TRAND%(48<<8)),SCRAP3+(TRAND&3),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); sprite[j].pal = 8; @@ -2123,7 +2123,7 @@ void checkhitsprite(int i,int sn) } case HANGLIGHT__STATIC: case GENERICPOLE2__STATIC: - for (k=0;k<6;k++) + for (k=6;k>0;k--) EGS(SECT,SX,SY,SZ-(8<<8),SCRAP1+(TRAND&15),-8,48,48,TRAND&2047,(TRAND&63)+64,-(TRAND&4095)-(sprite[i].zvel>>2),i,5); spritesound(GLASS_HEAVYBREAK,i); deletesprite(i); @@ -2138,7 +2138,7 @@ void checkhitsprite(int i,int sn) spritesound(GLASS_HEAVYBREAK,i); s = &sprite[i]; - for (j=0;j<16;j++) RANDOMSCRAP; + for (j=16;j>0;j--) RANDOMSCRAP; break; case WATERFOUNTAIN__STATIC: @@ -2154,7 +2154,7 @@ void checkhitsprite(int i,int sn) case ANTENNA__STATIC: if (sprite[sn].extra != *actorscrptr[SHOTSPARK1]) { - for (j=0;j<15;j++) + for (j=15;j>0;j--) EGS(SECT,SX,SY,sector[SECT].floorz-(12<<8)-(j<<9),SCRAP1+(TRAND&15),-8,64,64, TRAND&2047,(TRAND&127)+64,-(TRAND&511)-256,i,5); spawn(i,EXPLOSION2); @@ -2210,7 +2210,7 @@ void checkhitsprite(int i,int sn) lotsofglass(i,-1,10); break; case FETUSBROKE__STATIC: - for (j=0;j<48;j++) + for (j=48;j>0;j--) { shoot(i,BLOODSPLAT1); SA += 333; @@ -2379,7 +2379,7 @@ void checkhitsprite(int i,int sn) case TRIPODCAMERA__STATIC: spritesound(GLASS_HEAVYBREAK,i); s = &sprite[i]; - for (j=0;j<16;j++) RANDOMSCRAP; + for (j=16;j>0;j--) RANDOMSCRAP; deletesprite(i); break; case PLAYERONWATER__STATIC: