diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index e8acfe8d2..f7c5a3951 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -5028,7 +5028,7 @@ static void moveexplosions(void) // STATNUM 5 if (s->xvel > 0) s->xvel--; else s->xvel = 0; - if ((t[5]++) == ((30*10)-1)) + if (++t[5] == (30*10)) KILLIT(i); if (s->zvel > 1024 && s->zvel < 1280) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index d2f0851e7..f75439267 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -11885,7 +11885,7 @@ static void fakedomovethings(void) } } - if (abs(myxvel) < 2048 && abs(myyvel) < 2048) + if (klabs(myxvel) < 2048 && klabs(myyvel) < 2048) myxvel = myyvel = 0; if (shrunk) diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 6e43c81a9..320c3ae5e 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -567,7 +567,9 @@ int shoot(int i,int atwith) dal -= (8<<8); return -1; } - zvel = ((sprite[j].z-sz-dal)<<8) / ldist(&sprite[g_player[p].ps->i], &sprite[j]) ; + hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitx == 0) hitx++; + zvel = ((sprite[j].z-sz-dal)<<8) / hitx; sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -885,7 +887,9 @@ DOSKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); - zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]); + hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitx == 0) hitx++; + zvel = ((sprite[j].z-sz-dal)*vel) / hitx; if (sprite[j].picnum != RECON) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -1133,7 +1137,9 @@ DOSKIPBULLETHOLE: dal -= (8<<8); } - zvel = ((sprite[j].z-sz-dal)<<8) / ldist(&sprite[g_player[p].ps->i], &sprite[j]) ; + hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitx == 0) hitx++; + zvel = ((sprite[j].z-sz-dal)<<8) / hitx; sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -1416,7 +1422,9 @@ SKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)-(12<<8); - zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]) ; + hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitx == 0) hitx++; + zvel = ((sprite[j].z-sz-dal)*vel) / hitx; sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } else @@ -1427,7 +1435,9 @@ SKIPBULLETHOLE: j = findplayer(s,&x); // sa = getangle(g_player[j].ps->oposx-sx,g_player[j].ps->oposy-sy); sa += 16-(TRAND&31); - zvel = (((g_player[j].ps->oposz - sz + (3<<8)))*vel) / ldist(&sprite[g_player[j].ps->i],s); + hitx = ldist(&sprite[g_player[j].ps->i],s); + if (hitx == 0) hitx++; + zvel = (((g_player[j].ps->oposz - sz + (3<<8)))*vel) / hitx; } if (hittype[i].temp_data[9]) zvel = hittype[i].temp_data[9]; oldzvel = zvel; @@ -1516,7 +1526,9 @@ SKIPBULLETHOLE: if (j >= 0) { dal = ((sprite[j].yrepeat*tilesizy[sprite[j].picnum])<<1)+(8<<8); - zvel = ((sprite[j].z-sz-dal)*vel) / ldist(&sprite[g_player[p].ps->i], &sprite[j]); + hitx = ldist(&sprite[g_player[p].ps->i], &sprite[j]); + if (hitx == 0) hitx++; + zvel = ((sprite[j].z-sz-dal)*vel) / hitx; if (sprite[j].picnum != RECON) sa = getangle(sprite[j].x-sx,sprite[j].y-sy); } @@ -4376,7 +4388,7 @@ void processinput(int snum) } } - if (abs(p->posxv) < 2048 && abs(p->posyv) < 2048) + if (klabs(p->posxv) < 2048 && klabs(p->posyv) < 2048) p->posxv = p->posyv = 0; if (shrunk)