Commit 1eb95599 authored by Richard Gobeille's avatar Richard Gobeille

This should fix most of the remaining issues with projectiles colliding with...

This should fix most of the remaining issues with projectiles colliding with ledges they shouldn't be hitting

From-SVN: r7436
parent f924d054
......@@ -388,6 +388,8 @@ static int32_t A_CheckNeedZUpdate(int32_t spriteNum, int32_t zChange, int32_t *p
*pZcoord = newZ;
A_GetZLimits(spriteNum);
if (newZ > actor[spriteNum].ceilingz && newZ <= actor[spriteNum].floorz)
return 1;
......@@ -416,33 +418,13 @@ static int32_t A_CheckNeedZUpdate(int32_t spriteNum, int32_t zChange, int32_t *p
return 0;
}
int32_t A_MoveSpriteClipdist(int32_t spriteNum, vec3_t const * const change, uint32_t clipType, int32_t clipDist)
int A_GetClipdist(int spriteNum, int clipDist)
{
spritetype *const pSprite = &sprite[spriteNum];
int const isEnemy = A_CheckEnemySprite(pSprite);
vec2_t const oldPos = *(vec2_t *)pSprite;
// check to make sure the netcode didn't leave a deleted sprite in the sprite lists.
Bassert(pSprite->sectnum < MAXSECTORS);
#ifndef EDUKE32_STANDALONE
if (pSprite->statnum == STAT_MISC || (isEnemy && pSprite->xrepeat < 4))
{
pSprite->x += change->x;
pSprite->y += change->y;
pSprite->z += change->z;
if (isEnemy)
setsprite(spriteNum, (vec3_t *)pSprite);
return 0;
}
#endif
setsprite(spriteNum, (vec3_t *)pSprite);
if (clipDist < 0)
{
spritetype *const pSprite = &sprite[spriteNum];
int const isEnemy = A_CheckEnemySprite(pSprite);
if (A_CheckSpriteFlags(spriteNum, SFLAG_REALCLIPDIST))
clipDist = pSprite->clipdist << 2;
else if (isEnemy)
......@@ -461,12 +443,42 @@ int32_t A_MoveSpriteClipdist(int32_t spriteNum, vec3_t const * const change, uin
else
{
if (pSprite->statnum == STAT_PROJECTILE && (SpriteProjectile[spriteNum].workslike & PROJECTILE_REALCLIPDIST) == 0)
clipDist = 8;
clipDist = 16;
else
clipDist = pSprite->clipdist << 2;
}
}
return clipDist;
}
int32_t A_MoveSpriteClipdist(int32_t spriteNum, vec3_t const * const change, uint32_t clipType, int32_t clipDist)
{
spritetype *const pSprite = &sprite[spriteNum];
int const isEnemy = A_CheckEnemySprite(pSprite);
vec2_t const oldPos = *(vec2_t *)pSprite;
// check to make sure the netcode didn't leave a deleted sprite in the sprite lists.
Bassert(pSprite->sectnum < MAXSECTORS);
#ifndef EDUKE32_STANDALONE
if (pSprite->statnum == STAT_MISC || (isEnemy && pSprite->xrepeat < 4))
{
pSprite->x += change->x;
pSprite->y += change->y;
pSprite->z += change->z;
if (isEnemy)
setsprite(spriteNum, (vec3_t *)pSprite);
return 0;
}
#endif
setsprite(spriteNum, (vec3_t *)pSprite);
clipDist = A_GetClipdist(spriteNum, clipDist);
int16_t newSectnum = pSprite->sectnum;
#ifndef EDUKE32_STANDALONE
int const oldSectnum = newSectnum;
......@@ -489,7 +501,7 @@ int32_t A_MoveSpriteClipdist(int32_t spriteNum, vec3_t const * const change, uin
case STAT_PROJECTILE:
{
returnValue = clipmovex((vec3_t *)pSprite, &newSectnum, change->x << 13, change->y << 13, clipDist, diffZ >> 2, diffZ >> 2, clipType, 1);
returnValue = clipmovex((vec3_t *)pSprite, &newSectnum, change->x << 13, change->y << 13, clipDist, diffZ >> 1, diffZ >> 1, clipType, 1);
break;
}
}
......@@ -2788,7 +2800,7 @@ static int Proj_MaybeDamageCF(int spriteNum)
ACTOR_STATIC void Proj_MoveCustom(int const spriteNum)
{
int const projectileMoved = SpriteProjectile[spriteNum].workslike & PROJECTILE_MOVED;
int projectileMoved = SpriteProjectile[spriteNum].workslike & PROJECTILE_MOVED;
SpriteProjectile[spriteNum].workslike |= PROJECTILE_MOVED;
const projectile_t *const pProj = &SpriteProjectile[spriteNum];
spritetype *const pSprite = &sprite[spriteNum];
......@@ -2840,8 +2852,6 @@ ACTOR_STATIC void Proj_MoveCustom(int const spriteNum)
if (pProj->workslike & PROJECTILE_SPIT && pSprite->zvel < 6144)
pSprite->zvel += g_spriteGravity - 112;
A_GetZLimits(spriteNum);
if (pProj->trail >= 0)
{
for (bssize_t cnt = 0; cnt <= pProj->tnum; cnt++)
......@@ -2870,10 +2880,11 @@ ACTOR_STATIC void Proj_MoveCustom(int const spriteNum)
do
{
vec3_t tmpvect = { (projVel * (sintable[(pSprite->ang + 512) & 2047])) >> 14,
(projVel * (sintable[pSprite->ang & 2047])) >> 14, projZvel };
vec3_t tmpvect = { (projVel * (sintable[(pSprite->ang + 512) & 2047])) >> 14 >> (int)!projectileMoved,
(projVel * (sintable[pSprite->ang & 2047])) >> 14 >> (int)!projectileMoved, projZvel >> (int)!projectileMoved };
Bmemcpy(&davect, pSprite, sizeof(vec3_t));
otherSprite = A_MoveSprite(spriteNum, &tmpvect, (!projectileMoved || A_CheckSpriteFlags(spriteNum, SFLAG_NOCLIP) ? 0 : CLIPMASK1));
projectileMoved++;
otherSprite = A_MoveSprite(spriteNum, &tmpvect, (A_CheckSpriteFlags(spriteNum, SFLAG_NOCLIP) ? 0 : CLIPMASK1));
}
while (!otherSprite && --projMoveCnt > 0);
......@@ -3115,8 +3126,6 @@ ACTOR_STATIC void G_MoveWeapons(void)
vec3_t davect = *(vec3_t *) pSprite;
A_GetZLimits(spriteNum);
if (pSprite->picnum == RPG && actor[spriteNum].picnum != BOSS2 && pSprite->xrepeat >= 10
&& sector[pSprite->sectnum].lotag != ST_2_UNDERWATER
&& g_scriptVersion >= 13)
......@@ -3125,10 +3134,10 @@ ACTOR_STATIC void G_MoveWeapons(void)
sprite[newSprite].z += (1 << 8);
}
vec3_t const tmpvect = { (spriteXvel * (sintable[(pSprite->ang + 512) & 2047])) >> 14,
(spriteXvel * (sintable[pSprite->ang & 2047])) >> 14, spriteZvel };
vec3_t const tmpvect = { (spriteXvel * (sintable[(pSprite->ang + 512) & 2047])) >> 14 >> (int)!projectileMoved,
(spriteXvel * (sintable[pSprite->ang & 2047])) >> 14 >> (int)!projectileMoved, spriteZvel >> (int)!projectileMoved };
int moveSprite = A_MoveSprite(spriteNum, &tmpvect, (!projectileMoved || A_CheckSpriteFlags(spriteNum, SFLAG_NOCLIP) ? 0 : CLIPMASK1));
int moveSprite = A_MoveSprite(spriteNum, &tmpvect, (A_CheckSpriteFlags(spriteNum, SFLAG_NOCLIP) ? 0 : CLIPMASK1));
if (pSprite->picnum == RPG && (unsigned) pSprite->yvel < MAXSPRITES) // RPG_YVEL
if (FindDistance2D(pSprite->x - sprite[pSprite->yvel].x, pSprite->y - sprite[pSprite->yvel].y) < 256)
......
......@@ -223,7 +223,7 @@ typedef struct netactor_s
incval,
delay;
int32_t
int32_t
actiontics;
#endif
......@@ -263,7 +263,7 @@ typedef struct netactor_s
// note: lightId, lightcount, lightmaxrange are not synchronized between client and server
int32_t
int32_t
cgg;
......@@ -442,6 +442,7 @@ void A_AddToDeleteQueue(int spriteNum);
void A_DeleteSprite(int spriteNum);
void A_DoGuts(int spriteNum, int tileNum, int spawnCnt);
void A_DoGutsDir(int spriteNum, int tileNum, int spawnCnt);
int A_GetClipdist(int spriteNum, int clipDist);
void A_MoveCyclers(void);
void A_MoveDummyPlayers(void);
void A_MoveSector(int spriteNum);
......
......@@ -399,8 +399,9 @@ void A_GetZLimits(int const spriteNum)
{
auto const pSprite = &sprite[spriteNum];
int32_t ceilhit, florhit;
int const clipDist = A_GetClipdist(spriteNum, -1);
VM_GetZRange(spriteNum, &ceilhit, &florhit, (pSprite->statnum == STAT_PROJECTILE) ? 4 : 127);
VM_GetZRange(spriteNum, &ceilhit, &florhit, pSprite->statnum == STAT_PROJECTILE ? clipDist << 3 : clipDist);
actor[spriteNum].flags &= ~SFLAG_NOFLOORSHADOW;
if ((florhit&49152) == 49152 && (sprite[florhit&(MAXSPRITES-1)].cstat&48) == 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment