mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
actors.c: factor out 6x identical code into Proj_BounceOffWall().
git-svn-id: https://svn.eduke32.com/eduke32@3461 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
46fc753f6a
commit
2c3ffa291c
1 changed files with 14 additions and 25 deletions
|
@ -2513,6 +2513,14 @@ static void G_WeaponHitCeilingOrFloor(int32_t i, spritetype *s, int32_t *j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Proj_BounceOffWall(spritetype *s, int32_t j)
|
||||||
|
{
|
||||||
|
int32_t k = getangle(
|
||||||
|
wall[wall[j].point2].x-wall[j].x,
|
||||||
|
wall[wall[j].point2].y-wall[j].y);
|
||||||
|
s->ang = ((k<<1) - s->ang)&2047;
|
||||||
|
}
|
||||||
|
|
||||||
ACTOR_STATIC void G_MoveWeapons(void)
|
ACTOR_STATIC void G_MoveWeapons(void)
|
||||||
{
|
{
|
||||||
int32_t i = headspritestat[STAT_PROJECTILE], j=0, k, q;
|
int32_t i = headspritestat[STAT_PROJECTILE], j=0, k, q;
|
||||||
|
@ -2705,10 +2713,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
|
||||||
if (proj->workslike & PROJECTILE_BOUNCESOFFMIRRORS &&
|
if (proj->workslike & PROJECTILE_BOUNCESOFFMIRRORS &&
|
||||||
(wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
|
(wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
|
||||||
{
|
{
|
||||||
k = getangle(
|
Proj_BounceOffWall(s, j);
|
||||||
wall[wall[j].point2].x-wall[j].x,
|
|
||||||
wall[wall[j].point2].y-wall[j].y);
|
|
||||||
s->ang = ((k<<1) - s->ang)&2047;
|
|
||||||
s->owner = i;
|
s->owner = i;
|
||||||
A_Spawn(i,TRANSPORTERSTAR);
|
A_Spawn(i,TRANSPORTERSTAR);
|
||||||
goto BOLT;
|
goto BOLT;
|
||||||
|
@ -2723,10 +2728,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
|
||||||
if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR)
|
if (wall[j].overpicnum != MIRROR && wall[j].picnum != MIRROR)
|
||||||
s->yvel--;
|
s->yvel--;
|
||||||
|
|
||||||
k = getangle(
|
Proj_BounceOffWall(s, j);
|
||||||
wall[wall[j].point2].x-wall[j].x,
|
|
||||||
wall[wall[j].point2].y-wall[j].y);
|
|
||||||
s->ang = ((k<<1) - s->ang)&2047;
|
|
||||||
|
|
||||||
if (proj->bsound >= 0)
|
if (proj->bsound >= 0)
|
||||||
A_PlaySound(proj->bsound,i);
|
A_PlaySound(proj->bsound,i);
|
||||||
|
@ -2963,10 +2965,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
|
||||||
|
|
||||||
if (s->picnum != RPG && s->picnum != FREEZEBLAST && s->picnum != SPIT && (wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
|
if (s->picnum != RPG && s->picnum != FREEZEBLAST && s->picnum != SPIT && (wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR))
|
||||||
{
|
{
|
||||||
k = getangle(
|
Proj_BounceOffWall(s, j);
|
||||||
wall[wall[j].point2].x-wall[j].x,
|
|
||||||
wall[wall[j].point2].y-wall[j].y);
|
|
||||||
s->ang = ((k<<1) - s->ang)&2047;
|
|
||||||
s->owner = i;
|
s->owner = i;
|
||||||
A_Spawn(i,TRANSPORTERSTAR);
|
A_Spawn(i,TRANSPORTERSTAR);
|
||||||
goto BOLT;
|
goto BOLT;
|
||||||
|
@ -2984,10 +2983,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
|
||||||
s->yvel--;
|
s->yvel--;
|
||||||
}
|
}
|
||||||
|
|
||||||
k = getangle(
|
Proj_BounceOffWall(s, j);
|
||||||
wall[wall[j].point2].x-wall[j].x,
|
|
||||||
wall[wall[j].point2].y-wall[j].y);
|
|
||||||
s->ang = ((k<<1) - s->ang)&2047;
|
|
||||||
goto BOLT;
|
goto BOLT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3657,10 +3653,7 @@ ACTOR_STATIC void G_MoveActors(void)
|
||||||
if ((j&49152) == 32768)
|
if ((j&49152) == 32768)
|
||||||
{
|
{
|
||||||
j &= (MAXWALLS-1);
|
j &= (MAXWALLS-1);
|
||||||
k = getangle(
|
Proj_BounceOffWall(s, j);
|
||||||
wall[wall[j].point2].x-wall[j].x,
|
|
||||||
wall[wall[j].point2].y-wall[j].y);
|
|
||||||
s->ang = ((k<<1) - s->ang)&2047;
|
|
||||||
}
|
}
|
||||||
else if ((j&49152) == 49152)
|
else if ((j&49152) == 49152)
|
||||||
{
|
{
|
||||||
|
@ -4508,11 +4501,7 @@ ACTOR_STATIC void G_MoveActors(void)
|
||||||
Bmemcpy(&davect, s, sizeof(vec3_t));
|
Bmemcpy(&davect, s, sizeof(vec3_t));
|
||||||
A_DamageWall(i,j,&davect,s->picnum);
|
A_DamageWall(i,j,&davect,s->picnum);
|
||||||
|
|
||||||
k = getangle(
|
Proj_BounceOffWall(s, j);
|
||||||
wall[wall[j].point2].x-wall[j].x,
|
|
||||||
wall[wall[j].point2].y-wall[j].y);
|
|
||||||
|
|
||||||
s->ang = ((k<<1) - s->ang)&2047;
|
|
||||||
s->xvel >>= 1;
|
s->xvel >>= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue