- floatified WallBounce

This commit is contained in:
Christoph Oelckers 2022-08-31 00:48:43 +02:00
parent 9aedc3fe9e
commit d946e5de70
3 changed files with 25 additions and 53 deletions

View file

@ -388,7 +388,7 @@ int DoBloodSpray(DSWActor* actor)
wall_ang = NORM_ANGLE(hitActor->int_ang()); wall_ang = NORM_ANGLE(hitActor->int_ang());
SpawnMidSplash(actor); SpawnMidSplash(actor);
QueueWallBlood(actor, hitActor->int_ang()); QueueWallBlood(actor, hitActor->int_ang());
WallBounce(actor, wall_ang); WallBounce(actor, hitActor->spr.angle);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
} }
else else
@ -573,8 +573,7 @@ int DoPhosphorus(DSWActor* actor)
if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
wall_ang = NORM_ANGLE(hitActor->int_ang()); WallBounce(actor, hitActor->spr.angle);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
} }
else else
@ -611,9 +610,7 @@ int DoPhosphorus(DSWActor* actor)
break; break;
} }
wall_ang = NORM_ANGLE(getangle(wph->delta()) + 512); WallBounce(actor, wph->delta().Angle() + DAngle90);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
break; break;
} }
@ -776,8 +773,7 @@ int DoChemBomb(DSWActor* actor)
if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
wall_ang = NORM_ANGLE(hitActor->int_ang()); WallBounce(actor, hitActor->spr.angle);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
} }
else else
@ -813,9 +809,7 @@ int DoChemBomb(DSWActor* actor)
if (!(actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) if (!(actor->spr.cstat & CSTAT_SPRITE_INVISIBLE))
PlaySound(DIGI_CHEMBOUNCE, actor, v3df_dontpan); PlaySound(DIGI_CHEMBOUNCE, actor, v3df_dontpan);
int wall_ang = NORM_ANGLE(getangle(wph->delta()) + 512); WallBounce(actor, wph->delta().Angle() + DAngle90);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
break; break;
} }
@ -997,8 +991,7 @@ int DoCaltrops(DSWActor* actor)
if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
wall_ang = NORM_ANGLE(hitActor->int_ang()); WallBounce(actor, hitActor->spr.angle);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 10000); ScaleSpriteVector(actor, 10000);
} }
else else
@ -1024,9 +1017,7 @@ int DoCaltrops(DSWActor* actor)
PlaySound(DIGI_CALTROPS, actor, v3df_dontpan); PlaySound(DIGI_CALTROPS, actor, v3df_dontpan);
int wall_ang = NORM_ANGLE(getangle(wph->delta()) + 512); WallBounce(actor, wph->delta().Angle() + DAngle90);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 1000); ScaleSpriteVector(actor, 1000);
break; break;
} }

View file

@ -7470,9 +7470,7 @@ int DoStar(DSWActor* actor)
if (RANDOM_P2(1024) < STAR_BOUNCE_RNUM) if (RANDOM_P2(1024) < STAR_BOUNCE_RNUM)
break; break;
wall_ang = NORM_ANGLE(getangle(wph->delta())+512); WallBounce(actor, wph->delta().Angle() + DAngle90);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 36000); ScaleSpriteVector(actor, 36000);
actor->user.Flags |= (SPR_BOUNCE); actor->user.Flags |= (SPR_BOUNCE);
actor->user.motion_blur_num = 0; actor->user.motion_blur_num = 0;
@ -8086,29 +8084,24 @@ void ScaleSpriteVector(DSWActor* actor, int scale)
actor->user.change *= FixedToFloat(scale); actor->user.change *= FixedToFloat(scale);
} }
void WallBounce(DSWActor* actor, short ang) void WallBounce(DSWActor* actor, DAngle ang)
{ {
int old_ang;
int k,l;
int dax, day;
actor->user.bounce++; actor->user.bounce++;
k = MulScale(bcos(ang), bsin(ang), 13); double k = ang.Cos() * ang.Sin() * 2;
l = bcos(ang << 1); double l = (ang * 2).Cos();
dax = -actor->user.int_change().X; auto davec = -actor->user.change.XY();
day = -actor->user.int_change().Y;
actor->user.set_int_change_x(DMulScale(day, k, dax, l, 14)); actor->user.change.X = davec.Y * k + davec.X * l;
actor->user.set_int_change_y(DMulScale(dax, k, -day, l, 14)); actor->user.change.Y = davec.X * k - davec.Y * l;
old_ang = actor->int_ang(); auto old_ang = actor->spr.angle;
SetAngleFromChange(actor); SetAngleFromChange(actor);
// hack to prevent missile from sticking to a wall // hack to prevent missile from sticking to a wall
// //
if (old_ang == actor->int_ang()) if (old_ang == actor->spr.angle)
{ {
actor->user.change.XY() = -actor->user.change.XY(); actor->user.change.XY() = -actor->user.change.XY();
SetAngleFromChange(actor); SetAngleFromChange(actor);
@ -8232,8 +8225,7 @@ int DoGrenade(DSWActor* actor)
if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
wall_ang = NORM_ANGLE(hitActor->int_ang()); WallBounce(actor, hitActor->spr.angle);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
} }
else else
@ -8271,10 +8263,7 @@ int DoGrenade(DSWActor* actor)
PlaySound(DIGI_40MMBNCE, actor, v3df_dontpan); PlaySound(DIGI_40MMBNCE, actor, v3df_dontpan);
wall_ang = NORM_ANGLE(getangle(wph->delta())+512); WallBounce(actor, wph->delta().Angle() + DAngle90);
//actor->spr.angle = NORM_ANGLE(actor->spr.angle + 1);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 22000); ScaleSpriteVector(actor, 22000);
break; break;
@ -8440,8 +8429,7 @@ int DoVulcanBoulder(DSWActor* actor)
if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
wall_ang = NORM_ANGLE(hitActor->int_ang()); WallBounce(actor, hitActor->spr.angle);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 40000); ScaleSpriteVector(actor, 40000);
} }
else else
@ -8468,9 +8456,7 @@ int DoVulcanBoulder(DSWActor* actor)
break; break;
} }
wall_ang = NORM_ANGLE(getangle(wph->delta())+512); WallBounce(actor, wph->delta().Angle() + DAngle90);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 40000); ScaleSpriteVector(actor, 40000);
break; break;
} }
@ -17645,8 +17631,7 @@ int DoShrapVelocity(DSWActor* actor)
auto hit_sprite = actor->user.coll.actor(); auto hit_sprite = actor->user.coll.actor();
wall_ang = NORM_ANGLE(hit_sprite->int_ang()); WallBounce(actor, hit_sprite->spr.angle);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
break; break;
@ -17654,9 +17639,7 @@ int DoShrapVelocity(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
int wall_ang = NORM_ANGLE(getangle(actor->user.coll.hitWall->delta())+512); WallBounce(actor, actor->user.coll.hitWall->delta().Angle() + DAngle90);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
break; break;
} }
@ -17954,8 +17937,7 @@ int DoItemFly(DSWActor* actor)
if ((hit_sprite->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL)) if ((hit_sprite->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
{ {
wall_ang = NORM_ANGLE(hit_sprite->int_ang()); WallBounce(actor, hit_sprite->spr.angle);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
} }
else else
@ -17968,8 +17950,7 @@ int DoItemFly(DSWActor* actor)
case kHitWall: case kHitWall:
{ {
int wall_ang = NORM_ANGLE(getangle(actor->user.coll.hitWall->delta())+512); WallBounce(actor, actor->user.coll.hitWall->delta().Angle() + DAngle90);
WallBounce(actor, wall_ang);
ScaleSpriteVector(actor, 32000); ScaleSpriteVector(actor, 32000);
break; break;
} }

View file

@ -182,7 +182,7 @@ extern short StatDamageList[STAT_DAMAGE_LIST_SIZE];
#define MUSHROOM_CLOUD 3280 #define MUSHROOM_CLOUD 3280
extern STATE s_NukeMushroom[]; extern STATE s_NukeMushroom[];
void WallBounce(DSWActor*, short ang); void WallBounce(DSWActor*, DAngle ang);
#define PUFF 1748 #define PUFF 1748
#define CALTROPS 2218 #define CALTROPS 2218