- add_int_xvel

This commit is contained in:
Christoph Oelckers 2022-09-01 17:02:38 +02:00
parent 33eeb8d9c2
commit d19e99481d
10 changed files with 30 additions and 30 deletions

View file

@ -654,7 +654,7 @@ void movecrane(DDukeActor *actor, int crane)
if (actor->int_xvel() < 184)
{
actor->spr.picnum = crane + 1;
actor->spr.xvel += 8;
actor->add_int_xvel( 8);
}
//IFMOVING; // JBF 20040825: see my rant above about this
ssp(actor, CLIPMASK0);
@ -749,7 +749,7 @@ void movecrane(DDukeActor *actor, int crane)
else if (actor->temp_data[0] == 6)
{
if (actor->int_xvel() < 192)
actor->spr.xvel += 8;
actor->add_int_xvel( 8);
actor->spr.angle = VecToAngle(cpt.pos.XY() - actor->spr.pos.XY());
ssp(actor, CLIPMASK0);
if (((actor->spr.pos.X - cpt.pos.X) * (actor->spr.pos.X - cpt.pos.X) + (actor->spr.pos.Y - cpt.pos.Y) * (actor->spr.pos.Y - cpt.pos.Y)) < (8 * 8))
@ -1006,7 +1006,7 @@ void movetrash(DDukeActor *actor)
makeitfall(actor);
if (krand() & 1) actor->add_int_zvel(- 256);
if (abs(actor->spr.xvel) < 48)
actor->spr.xvel += (krand() & 3);
actor->add_int_xvel( (krand() & 3));
}
else deletesprite(actor);
}
@ -1435,7 +1435,7 @@ bool rat(DDukeActor* actor, bool makesound)
else actor->set_int_ang((krand() & 2047));
}
if (actor->int_xvel() < 128)
actor->spr.xvel += 2;
actor->add_int_xvel( 2);
actor->add_int_ang((krand() & 3) - 6);
return true;
}
@ -1730,7 +1730,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p
else
{
// Control speed here
if (l > 1524) { if (actor->int_xvel() < 256) actor->spr.xvel += 32; }
if (l > 1524) { if (actor->int_xvel() < 256) actor->add_int_xvel( 32); }
else
{
if(actor->float_xvel() > 0) actor->spr.xvel -= 16;
@ -2957,7 +2957,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
if (actor->int_xvel() == 0)
operateactivators(actor->spr.hitag + (!actor->temp_data[3]), -1);
if (actor->int_xvel() < 256)
actor->spr.xvel += 16;
actor->add_int_xvel( 16);
}
}
if (actor->temp_data[4] == 2)
@ -4984,7 +4984,7 @@ void alterang(int ang, DDukeActor* actor, int playernum)
aang = actor->int_ang();
actor->spr.xvel += (*moveptr - actor->spr.xvel) / 5;
actor->add_int_xvel( (*moveptr - actor->spr.xvel) / 5);
if (actor->float_zvel() < (648/256.)) actor->add_int_zvel( ((*(moveptr + 1) << 4) - actor->int_zvel()) / 5);
if (isRRRA() && (ang & windang))

View file

@ -395,7 +395,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
if (act2->spr.picnum != TANK && act2->spr.picnum != ROTATEGUN && act2->spr.picnum != RECON && !bossguy(act2))
{
if (act2->int_xvel() < 0) act2->clear_xvel();
act2->spr.xvel += (actor->spr.extra << 2);
act2->add_int_xvel( (actor->spr.extra << 2));
}
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
@ -2374,7 +2374,7 @@ static void greenslime(DDukeActor *actor)
}
else
{
if (actor->int_xvel() < 32) actor->spr.xvel += 4;
if (actor->int_xvel() < 32) actor->add_int_xvel( 4);
actor->set_int_xvel(64 - bcos(actor->temp_data[1], -9));
actor->add_int_ang(getincangle(actor->int_ang(),
@ -3168,7 +3168,7 @@ void handle_se06_d(DDukeActor* actor)
if (actor->temp_data[4] > ((k >> 1) - 1) && actor->temp_data[4] < (k - (k >> 3)))
actor->clear_xvel();
if (actor->temp_data[4] < (k >> 1))
actor->spr.xvel += (k >> 5);
actor->add_int_xvel( (k >> 5));
if (actor->temp_data[4] < ((k >> 1) - (k >> 3)))
{
actor->temp_data[4] = 0;
@ -3190,7 +3190,7 @@ void handle_se06_d(DDukeActor* actor)
int x = Sgn(dist(act2, actor) - act2->temp_data[5]);
if (act2->spr.extra)
x = -x;
actor->spr.xvel += x;
actor->add_int_xvel( x);
}
act2->temp_data[4] = actor->temp_data[4];
}
@ -3551,7 +3551,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
auto moveptr = &ScriptCode[actor->temp_data[1]];
if (a & geth) actor->spr.xvel += (*moveptr - actor->spr.xvel) >> 1;
if (a & geth) actor->add_int_xvel( (*moveptr - actor->spr.xvel) >> 1);
if (a & getv) actor->add_int_zvel( ((*(moveptr + 1) << 4) - actor->int_zvel()) >> 1);
if (a & dodgebullet)

View file

@ -331,7 +331,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
(pic != HULK && pic != SBMOVE))
{
if (act2->int_xvel() < 0) act2->clear_xvel();
act2->spr.xvel += (act2->spr.extra << 2);
act2->add_int_xvel( (act2->spr.extra << 2));
}
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
@ -3155,7 +3155,7 @@ void handle_se06_r(DDukeActor *actor)
if (actor->temp_data[4] > ((k >> 1) - 1) && actor->temp_data[4] < (k - (k >> 3)))
actor->clear_xvel();
if (actor->temp_data[4] < (k >> 1))
actor->spr.xvel += (k >> 5);
actor->add_int_xvel( (k >> 5));
if (actor->temp_data[4] < ((k >> 1) - (k >> 3)))
{
actor->temp_data[4] = 0;
@ -3241,7 +3241,7 @@ void handle_se06_r(DDukeActor *actor)
act2->temp_data[5] = dist(act2, actor);
int x = Sgn(dist(act2, actor) - act2->temp_data[5]);
if (act2->spr.extra) x = -x;
actor->spr.xvel += x;
actor->add_int_xvel( x);
}
act2->temp_data[4] = actor->temp_data[4];
}
@ -3620,7 +3620,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
auto moveptr = &ScriptCode[actor->temp_data[1]];
if (a & geth) actor->spr.xvel += (*moveptr - actor->spr.xvel) >> 1;
if (a & geth) actor->add_int_xvel( (*moveptr - actor->spr.xvel) >> 1);
if (a & getv) actor->add_int_zvel( ((*(moveptr + 1) << 4) - actor->int_zvel()) >> 1);
if (a & dodgebullet)

View file

@ -2382,7 +2382,7 @@ static void operateweapon(int snum, ESyncBits actions)
if (j)
{
j->set_int_ang((j->int_ang() + 1024) & 2047);
j->spr.xvel += 32;
j->add_int_xvel( 32);
j->spr.pos.Z += 3;
ssp(j, CLIPMASK0);
}

View file

@ -2979,7 +2979,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
{
j->set_int_ang((j->int_ang() + 1024) & 2047);
j->spr.xvel += 32;
j->add_int_xvel( 32);
j->spr.pos.Z += 3;
ssp(j, CLIPMASK0);
}
@ -4106,7 +4106,7 @@ void OffMotorcycle(player_struct *p)
if (spawned)
{
spawned->spr.angle = p->angle.ang;
spawned->spr.xvel += p->angle.ang.Cos() * (1 << 7);
spawned->add_int_xvel( p->angle.ang.Cos() * (1 << 7));
spawned->spr.yvel += p->angle.ang.Sin() * (1 << 7);
spawned->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON];
}
@ -4171,7 +4171,7 @@ void OffBoat(player_struct *p)
if (spawned)
{
spawned->spr.angle = p->angle.ang;
spawned->spr.xvel += p->angle.ang.Cos() * (1 << 7);
spawned->add_int_xvel( p->angle.ang.Cos() * (1 << 7));
spawned->spr.yvel += p->angle.ang.Sin() * (1 << 7);
spawned->saved_ammo = p->ammo_amount[BOAT_WEAPON];
}

View file

@ -126,7 +126,7 @@ void DoSpawn(player_struct *p, int snum)
{
// like chaingun shells
j->set_int_ang((j->int_ang() + 1024) & 2047);
j->spr.xvel += 32;
j->add_int_xvel( 32);
j->spr.pos.Z += 3;
ssp(j,CLIPMASK0);
}

View file

@ -233,7 +233,7 @@ void AIMummy::Tick(RunListEvent* ev)
}
else if (pActor->int_xvel() < 0)
{
pActor->spr.xvel += 1024;
pActor->add_int_xvel( 1024);
if (pActor->int_xvel() > 0) {
pActor->clear_xvel();
}

View file

@ -351,7 +351,7 @@ void AIRex::Tick(RunListEvent* ev)
}
else
{
pHitActor->spr.xvel += (xVel >> 3);
pHitActor->add_int_xvel( (xVel >> 3));
pHitActor->spr.yvel += (yVel >> 3);
pHitActor->set_int_zvel(-2880);
}

View file

@ -1655,7 +1655,7 @@ int runlist_CheckRadialDamage(DExhumedActor* pActor)
{
int nAngle = getangle(x, y);
pActor->spr.xvel += (edi * bcos(nAngle)) >> 3;
pActor->add_int_xvel( (edi * bcos(nAngle)) >> 3);
pActor->spr.yvel += (edi * bsin(nAngle)) >> 3;
pActor->add_int_zvel(- edi * 24);

View file

@ -3766,7 +3766,7 @@ AutoShrap:
actor->spr.pal = actor->user.spal = uint8_t(shrap_pal);
actor->set_int_xvel(p->min_vel*2);
actor->spr.xvel += RandomRange(p->max_vel - p->min_vel);
actor->add_int_xvel( RandomRange(p->max_vel - p->min_vel));
actor->user.floor_dist = 2;
actor->user.ceiling_dist = 2;
@ -4130,12 +4130,12 @@ int SpawnBlood(DSWActor* actor, DSWActor* weapActor, DAngle hit_angle, const DVe
actorNew->spr.pal = actorNew->user.spal = uint8_t(shrap_pal);
actorNew->set_int_xvel(p->min_vel);
actorNew->spr.xvel += RandomRange(p->max_vel - p->min_vel);
actorNew->add_int_xvel( RandomRange(p->max_vel - p->min_vel));
// special case
// blood coming off of actors should have the acceleration of the actor
// so add it in
actorNew->spr.xvel += actor->int_xvel();
actorNew->add_int_xvel( actor->int_xvel());
actorNew->user.ceiling_dist = actorNew->user.floor_dist = 2;
actorNew->user.jump_speed = p->min_jspeed;
@ -9133,7 +9133,7 @@ int DoRail(DSWActor* actor)
{
auto actorNew = SpawnActor(STAT_MISSILE, PUFF, &s_RailPuff[0][0], actor->sector(), actor->spr.pos, actor->spr.angle, 20);
actorNew->spr.xvel += (RandomRange(140)-RandomRange(140));
actorNew->add_int_xvel( (RandomRange(140)-RandomRange(140)));
actorNew->add_int_zvel( (RandomRange(140)-RandomRange(140)));
actorNew->user.RotNum = 5;
@ -11171,8 +11171,8 @@ int DoSerpRing(DSWActor* actor)
actor->user.ID = SKULL_R0;
actor->spr.angle = VecToAngle(actor->user.targetActor->spr.pos.XY() - actor->spr.pos.XY());
actor->set_int_xvel(dist>>5);
actor->spr.xvel += (actor->int_xvel() >> 1);
actor->spr.xvel += (RANDOM_P2(128<<8)>>8);
actor->add_int_xvel( (actor->int_xvel() >> 1));
actor->add_int_xvel( (RANDOM_P2(128<<8)>>8));
actor->user.jump_speed = -800;
change_actor_stat(actor, STAT_ENEMY);
NewStateGroup(actor, sg_SkullJump);