- several getangle(delta) blocks.

This commit is contained in:
Christoph Oelckers 2021-11-24 16:55:24 +01:00
parent 0a0cc85407
commit 82447233a7
9 changed files with 30 additions and 73 deletions

View file

@ -740,15 +740,15 @@ int WallBreakPosition(int hit_wall, int *sectnum, int *x, int *y, int *z, int *a
w = hit_wall;
wp = &wall[w];
nw = wall[w].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y)+512);
nw = wp->point2;
wall_ang = NORM_ANGLE(getangle(wp->delta())+512);
*sectnum = SectorOfWall(w);
ASSERT(*sectnum >= 0);
// midpoint of wall
*x = DIV2(wall[w].x + wall[w].x);
*y = DIV2(wall[w].y + wall[w].y);
*x = DIV2(wp->x + wp->x);
*y = DIV2(wp->y + wp->y);
//getzsofsector(*sectnum, *x, *y, cz, fz);

View file

@ -83,8 +83,7 @@ void SpawnWallSound(short sndnum, short i)
vec3_t mid;
// Get wall midpoint for offset in mirror view
mid.x = (wall[i].x + wall[wall[i].point2].x) / 2;
mid.y = (wall[i].y + wall[wall[i].point2].y) / 2;
mid.vec2 = wall[i].center();
mid.z = (sector[wall[i].nextsector].ceilingz + sector[wall[i].nextsector].floorz) / 2;
PlaySound(sndnum, &mid, v3df_dontpan | v3df_doppler);

View file

@ -440,8 +440,7 @@ int DoBloodSpray(DSWActor* actor)
WALLp wph;
short wb;
hit_wall = u->coll.index;
wph = &wall[hit_wall];
wph = u->coll.wall();
if (wph->lotag == TAG_WALL_BREAK)
{
@ -450,9 +449,7 @@ int DoBloodSpray(DSWActor* actor)
break;
}
nw = wall[hit_wall].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
wall_ang = NORM_ANGLE(getangle(wph->delta()) + 512);
SpawnMidSplash(actor);
auto bldActor = QueueWallBlood(actor, NORM_ANGLE(wall_ang+1024));
@ -653,8 +650,7 @@ int DoPhosphorus(DSWActor* actor)
short hit_wall, nw, wall_ang;
WALLp wph;
hit_wall = u->coll.index;
wph = &wall[hit_wall];
wph = u->coll.wall();
if (wph->lotag == TAG_WALL_BREAK)
{
@ -663,9 +659,7 @@ int DoPhosphorus(DSWActor* actor)
break;
}
nw = wall[hit_wall].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
wall_ang = NORM_ANGLE(getangle(wph->delta()) + 512);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000);
@ -866,11 +860,7 @@ int DoChemBomb(DSWActor* actor)
case kHitWall:
{
short hit_wall, nw, wall_ang;
WALLp wph;
hit_wall = u->coll.index;
wph = &wall[hit_wall];
auto wph = u->coll.wall();
if (wph->lotag == TAG_WALL_BREAK)
{
@ -882,8 +872,7 @@ int DoChemBomb(DSWActor* actor)
if (!TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
PlaySound(DIGI_CHEMBOUNCE, actor, v3df_dontpan);
nw = wall[hit_wall].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
int wall_ang = NORM_ANGLE(getangle(wph->delta()) + 512);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000);
@ -1096,8 +1085,7 @@ int DoCaltrops(DSWActor* actor)
case kHitWall:
{
int hit_wall = u->coll.index;
auto wph = &wall[hit_wall];
auto wph = u->coll.wall();
if (wph->lotag == TAG_WALL_BREAK)
{
@ -1108,8 +1096,7 @@ int DoCaltrops(DSWActor* actor)
PlaySound(DIGI_CALTROPS, actor, v3df_dontpan);
int nw = wall[hit_wall].point2;
int wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y) + 512);
int wall_ang = NORM_ANGLE(getangle(wph->delta()) + 512);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 1000);

View file

@ -1605,9 +1605,9 @@ void SlipSlope(PLAYERp pp)
if (!TEST(sectu->flags, SECTFU_SLIDE_SECTOR) || !TEST(pp->cursector()->floorstat, FLOOR_STAT_SLOPE))
return;
short wallptr = pp->cursector()->wallptr;
auto wallptr = pp->cursector()->firstWall();
ang = getangle(wall[wall[wallptr].point2].x - wall[wallptr].x, wall[wall[wallptr].point2].y - wall[wallptr].y);
ang = getangle(wallptr->delta());
ang = NORM_ANGLE(ang + 512);
@ -6043,16 +6043,9 @@ void DoPlayerDeathMoveHead(PLAYERp pp)
}
case kHitWall:
{
short w,nw,wall_ang,dang;
int wall_ang = NORM_ANGLE(getangle(u->coll.wall()->delta())-512);
//PlaySound(DIGI_DHCLUNK, pp, v3df_dontpan);
w = u->coll.index;
nw = wall[w].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y)-512);
dang = getincangle(wall_ang, u->slide_ang);
int dang = getincangle(wall_ang, u->slide_ang);
u->slide_ang = NORM_ANGLE(wall_ang + 1024 - dang);
SpawnShrap(pp->Actor(), nullptr);

View file

@ -1018,18 +1018,11 @@ int DoRipperMoveHang(DSWActor* actor)
{
if (u->coll.type == kHitWall)
{
short hit_wall;
short w, nw;
hit_wall = u->coll.index;
NewStateGroup(actor, u->ActorActionSet->Special[1]);
u->WaitTics = 2 + ((RANDOM_P2(4 << 8) >> 8) * 120);
// hang flush with the wall
w = hit_wall;
nw = wall[w].point2;
sp->ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y) - 512);
sp->ang = NORM_ANGLE(getangle(u->coll.wall()->delta()) - 512);
return 0;
}

View file

@ -1028,8 +1028,6 @@ int DoRipper2MoveHang(DSWActor* actor)
if (abs(sp->z - u->targetActor->s().z) > (4000<<4))
return 0;
hit_wall = u->coll.index;
NewStateGroup(actor, u->ActorActionSet->Special[1]);
if (RANDOM_P2(1024<<8)>>8 > 500)
u->WaitTics = ((RANDOM_P2(2 << 8) >> 8) * 120);
@ -1037,9 +1035,7 @@ int DoRipper2MoveHang(DSWActor* actor)
u->WaitTics = 0; // Double jump
// hang flush with the wall
w = hit_wall;
nw = wall[w].point2;
sp->ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y) - 512);
sp->ang = NORM_ANGLE(getangle(u->coll.wall()->delta()) - 512);
return 0;
}

View file

@ -233,7 +233,7 @@ void DoSlidorInterp(DSWActor* actor, INTERP_FUNC interp_func)
do
{
auto pwal = wal - 1;
if (pwal < startWall)
if (wal < startWall)
pwal = endWall;
EInterpolationType type = Interp_Invalid;;

View file

@ -220,7 +220,8 @@ struct HITINFO {
pos = hit->pos;
}
//walltype* Wall() const { return wall == -1? nullptr : &::wall[wall]; }
walltype* wall() const { return hitwall == -1? nullptr : &::wall[hitwall]; }
sectortype* sector() const { return hitsect == -1 ? nullptr : &::sector[hitsect]; }
};

View file

@ -7658,8 +7658,7 @@ int DoStar(DSWActor* actor)
if (RANDOM_P2(1024) < STAR_BOUNCE_RNUM)
break;
nw = wall[hit_wall].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y)+512);
wall_ang = NORM_ANGLE(getangle(wph->delta())+512);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 36000);
@ -8434,8 +8433,7 @@ bool SlopeBounce(DSWActor* actor, bool *hit_wall)
// get angle of the first wall of the sector
k = sector[hit_sector].wallptr;
l = wall[k].point2;
daang = getangle(wall[l].x - wall[k].x, wall[l].y - wall[k].y);
daang = getangle(wall[k].delta());
// k is now the slope of the ceiling or floor
@ -8557,8 +8555,7 @@ int DoGrenade(DSWActor* actor)
PlaySound(DIGI_40MMBNCE, actor, v3df_dontpan);
nw = wall[hit_wall].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y)+512);
wall_ang = NORM_ANGLE(getangle(wph->delta())+512);
//sp->ang = NORM_ANGLE(sp->ang + 1);
WallBounce(actor, wall_ang);
@ -8770,8 +8767,7 @@ int DoVulcanBoulder(DSWActor* actor)
break;
}
nw = wall[hit_wall].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wph->x, wall[nw].y - wph->y)+512);
wall_ang = NORM_ANGLE(getangle(wph->delta())+512);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 40000);
@ -16119,9 +16115,7 @@ DSWActor* SpawnWallHole(short hit_sect, short hit_wall, int hit_x, int hit_y, in
SET(sp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL);
SET(sp->cstat, CSTAT_SPRITE_ONE_SIDED);
w = hit_wall;
nw = wall[w].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y)-512);
wall_ang = NORM_ANGLE(getangle(wall[hit_wall].delta())-512);
sp->ang = NORM_ANGLE(wall_ang + 1024);
@ -16137,9 +16131,7 @@ bool HitscanSpriteAdjust(DSWActor* actor, int hit_wall)
if (hit_wall >= 0)
{
uint16_t const w = hit_wall;
uint16_t const nw = wall[hit_wall].point2;
int16_t const wall_ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y));
int16_t const wall_ang = NORM_ANGLE(getangle(wall[hit_wall].delta()));
ang = sp->ang = NORM_ANGLE(wall_ang + 512);
}
else
@ -18677,9 +18669,7 @@ void QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z)
SET(sp->cstat, CSTAT_SPRITE_ONE_SIDED);
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
w = hit_wall;
nw = wall[w].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y)+512);
wall_ang = NORM_ANGLE(getangle(wall[hit_wall].delta())+512);
sp->ang = wall_ang;
// move it back some
@ -19010,9 +19000,7 @@ DSWActor* QueueWallBlood(DSWActor* actor, short ang)
SET(sp->cstat, CSTAT_SPRITE_YCENTER);
RESET(sp->cstat, CSTAT_SPRITE_BLOCK|CSTAT_SPRITE_BLOCK_HITSCAN);
w = hitinfo.hitwall;
nw = wall[w].point2;
wall_ang = NORM_ANGLE(getangle(wall[nw].x - wall[w].x, wall[nw].y - wall[w].y)+512);
wall_ang = NORM_ANGLE(getangle(hitinfo.wall()->delta()) + 512);
sp->ang = wall_ang;
// move it back some