Remaining sanitizing of .yvel usage plus minor cleanup.

git-svn-id: https://svn.eduke32.com/eduke32@4229 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-12-28 17:04:36 +00:00
parent 2dd9b7e495
commit 21d8e52f0a
4 changed files with 28 additions and 22 deletions

View file

@ -2780,7 +2780,7 @@ ACTOR_STATIC void Proj_MoveCustom(int32_t i)
} while (!j && --cnt > 0);
}
if (!(proj->workslike & PROJECTILE_BOUNCESOFFWALLS) &&
if (!(proj->workslike & PROJECTILE_BOUNCESOFFWALLS) && // NOT_BOUNCESOFFWALLS_YVEL
(unsigned)s->yvel < MAXSPRITES && sprite[s->yvel].sectnum != MAXSECTORS)
if (FindDistance2D(s->x-sprite[s->yvel].x, s->y-sprite[s->yvel].y) < 256)
j = 49152|s->yvel;
@ -3059,7 +3059,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
}
if (s->picnum == RPG && (unsigned)s->yvel < MAXSPRITES)
if (s->picnum == RPG && (unsigned)s->yvel < MAXSPRITES) // RPG_YVEL
if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256)
j = 49152|s->yvel;
@ -5551,9 +5551,9 @@ ACTOR_STATIC void G_MoveMisc(void) // STATNUM 5
}
else
{
if (s->picnum == SCRAP1 && s->yvel > 0)
if (s->picnum == SCRAP1 && s->yvel > 0 && s->yvel < MAXUSERTILES)
{
int32_t j = A_Spawn(i,s->yvel);
int32_t j = A_Spawn(i, s->yvel);
setsprite(j,(vec3_t *)s);
A_GetZLimits(j);

View file

@ -7587,14 +7587,16 @@ PALONLY:
t->xrepeat = t->yrepeat = 0;
continue;
}
if (t->pal == 6) t->shade = -120;
if (t->pal == 6)
t->shade = -120;
/* fall-through */
case SCRAP1__STATIC:
case SCRAP2__STATIC:
case SCRAP3__STATIC:
case SCRAP4__STATIC:
case SCRAP5__STATIC:
if (actor[i].picnum == BLIMP && t->picnum == SCRAP1 && s->yvel >= 0)
t->picnum = s->yvel;
t->picnum = s->yvel < MAXUSERTILES ? s->yvel : 0;
else t->picnum += T1;
t->shade -= 6;

View file

@ -5217,7 +5217,8 @@ finish_qsprintf:
case PODFEM1__STATIC:
case NAKED1__STATIC:
case STATUE__STATIC:
if (vm.g_sp->yvel) G_OperateRespawns(vm.g_sp->yvel);
if (vm.g_sp->yvel)
G_OperateRespawns(vm.g_sp->yvel);
break;
default:
// if (vm.g_sp->hitag >= 0)

View file

@ -938,10 +938,11 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
if (p >= 0)
{
j = GetAutoAimAngle(i, p, atwith, 8 << 8, 0 + 2, srcvect, vel, &zvel, &sa);
// NOTE: j is a SPRITE_INDEX
j = GetAutoAimAngle(i, p, atwith, 8<<8, 0+2, srcvect, vel, &zvel, &sa);
if (j < 0)
zvel = (100 - ps->horiz - ps->horizoff)*(proj->vel / 8);
zvel = (100-ps->horiz-ps->horizoff)*(proj->vel/8);
if (proj->sound >= 0)
A_PlaySound(proj->sound, i);
@ -950,8 +951,9 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
{
if (!(proj->workslike & PROJECTILE_NOAIM))
{
// NOTE: j is a player index
j = A_FindPlayer(s, NULL);
sa = getangle(g_player[j].ps->opos.x - srcvect->x, g_player[j].ps->opos.y - srcvect->y);
sa = getangle(g_player[j].ps->opos.x-srcvect->x, g_player[j].ps->opos.y-srcvect->y);
l = safeldist(g_player[j].ps->i, s);
zvel = ((g_player[j].ps->opos.z - srcvect->z)*vel) / l;
@ -961,12 +963,11 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
}
}
if (p >= 0 && j >= 0)
l = j;
else l = -1;
if (numplayers > 1 && g_netClient) return -1;
// l may be a SPRITE_INDEX, see above
l = (p >= 0 && j >= 0) ? j : -1;
zvel = A_GetShootZvel(zvel);
j = A_InsertSprite(sect,
srcvect->x + (sintable[(348 + sa + 512) & 2047] / proj->offset),
@ -980,7 +981,7 @@ static int32_t A_ShootCustom(const int32_t i, const int32_t atwith, int16_t sa,
sprite[j].extra += (krand()&proj->extra_rand);
if (!(proj->workslike & PROJECTILE_BOUNCESOFFWALLS))
sprite[j].yvel = l;
sprite[j].yvel = l; // NOT_BOUNCESOFFWALLS_YVEL
else
{
if (proj->bounces >= 1) sprite[j].yvel = proj->bounces;
@ -1410,6 +1411,7 @@ int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
if (p >= 0)
{
// NOTE: j is a SPRITE_INDEX
j = GetAutoAimAngle(i, p, atwith, 8<<8, 0+2, &srcvect, vel, &zvel, &sa);
if (j < 0)
@ -1420,8 +1422,9 @@ int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
}
else
{
// NOTE: j is a player index
j = A_FindPlayer(s, NULL);
sa = getangle(g_player[j].ps->opos.x-srcvect.x,g_player[j].ps->opos.y-srcvect.y);
sa = getangle(g_player[j].ps->opos.x-srcvect.x, g_player[j].ps->opos.y-srcvect.y);
if (PN == BOSS3)
srcvect.z -= MinibossScale(32<<8);
else if (PN == BOSS2)
@ -1431,17 +1434,17 @@ int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
}
l = safeldist(g_player[j].ps->i, s);
zvel = ((g_player[j].ps->opos.z-srcvect.z)*vel) / l;
zvel = ((g_player[j].ps->opos.z - srcvect.z)*vel) / l;
if (A_CheckEnemySprite(s) && (s->hitag&face_player_smart))
sa = s->ang+(krand()&31)-16;
}
if (p >= 0 && j >= 0)
l = j;
else l = -1;
if (numplayers > 1 && g_netClient)
return -1;
if (numplayers > 1 && g_netClient) return -1;
// l may be a SPRITE_INDEX, see above
l = (p >= 0 && j >= 0) ? j : -1;
zvel = A_GetShootZvel(zvel);
j = A_InsertSprite(sect,
@ -1451,7 +1454,7 @@ int32_t A_ShootWithZvel(int32_t i, int32_t atwith, int32_t override_zvel)
sprite[j].extra += (krand()&7);
if (atwith != FREEZEBLAST)
sprite[j].yvel = l;
sprite[j].yvel = l; // RPG_YVEL
else
{
sprite[j].yvel = g_numFreezeBounces;