- eliminated add_int_xvel

This commit is contained in:
Christoph Oelckers 2022-09-11 22:57:56 +02:00
parent ccbe472444
commit 23c529589e
9 changed files with 28 additions and 28 deletions

View file

@ -138,11 +138,6 @@ public:
vel.X = v * inttoworld;
}
void add_int_xvel(int v)
{
vel.X += v * inttoworld;
}
vec3_t int_vel() const
{
return vec3_t(FloatToFixed(vel.X), FloatToFixed(vel.Y), FloatToFixed(vel.Z));

View file

@ -994,13 +994,13 @@ void movemasterswitch(DDukeActor *actor)
void movetrash(DDukeActor *actor)
{
if (actor->int_xvel() == 0) actor->set_int_xvel(1);
if (actor->vel.X == 0) actor->vel.X = 1 / 16.;
if (ssp(actor, CLIPMASK0))
{
makeitfall(actor);
if (krand() & 1) actor->vel.Z -= 1;
if (abs(actor->int_xvel()) < 48)
actor->add_int_xvel( (krand() & 3));
if (abs(actor->vel.X) < 3)
actor->vel.X += (krand() & 3) / 16.;
}
else deletesprite(actor);
}
@ -4980,11 +4980,14 @@ void alterang(int ang, DDukeActor* actor, int playernum)
aang = actor->int_ang();
actor->add_int_xvel( (*moveptr - actor->int_xvel()) / 5);
if (actor->vel.Z < (648/256.)) actor->add_int_zvel( ((*(moveptr + 1) << 4) - actor->int_zvel()) / 5);
actor->vel.X += (moveptr[0] / 16 - actor->vel.X) / 5;
if (actor->vel.Z < (648 / 256.))
{
actor->vel.Z += (moveptr[1] / 16 - actor->vel.Z) / 5;
}
if (isRRRA() && (ang & windang))
actor->set_int_ang(WindDir);
actor->spr.angle = WindDir;
else if (ang & seekplayer)
{
DDukeActor* holoduke = !isRR()? ps[playernum].holoduke_on.Get() : nullptr;

View file

@ -394,8 +394,8 @@ 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->vel.X = 0;
act2->add_int_xvel( (actor->spr.extra << 2));
if (act2->vel.X < 0) act2->vel.X = 0;
act2->vel.X += ( (actor->spr.extra / 4.));
}
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
@ -3549,8 +3549,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
auto moveptr = &ScriptCode[actor->temp_data[1]];
if (a & geth) actor->add_int_xvel( (*moveptr - actor->int_xvel()) >> 1);
if (a & getv) actor->add_int_zvel( ((*(moveptr + 1) << 4) - actor->int_zvel()) >> 1);
if (a & geth) actor->vel.X += (moveptr[0] / 16 - actor->vel.X) * 0.5;
if (a & getv) actor->vel.Z += (moveptr[1] / 16 - actor->vel.Z) * 0.5;
if (a & dodgebullet)
dodge(actor);
@ -3558,11 +3558,11 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (actor->spr.picnum != APLAYER)
alterang(a, actor, playernum);
if (actor->int_xvel() > -6 && actor->int_xvel() < 6) actor->vel.X = 0;
if (abs(actor->vel.X) < 6 / 16.) actor->vel.X = 0;
a = badguy(actor);
if (actor->vel.X != 0 || actor->int_zvel())
if (actor->vel.X != 0 || actor->vel.X != 0)
{
if (a && actor->spr.picnum != ROTATEGUN)
{

View file

@ -330,8 +330,8 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
(pic != HULK && pic != MAMA && pic != BILLYPLAY && pic != COOTPLAY && pic != MAMACLOUD) :
(pic != HULK && pic != SBMOVE))
{
if (act2->int_xvel() < 0) act2->vel.X = 0;
act2->add_int_xvel( (act2->spr.extra << 2));
if (act2->vel.X < 0) act2->vel.X = 0;
act2->vel.X += ((actor->spr.extra / 4.));
}
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
@ -3606,8 +3606,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
auto moveptr = &ScriptCode[actor->temp_data[1]];
if (a & geth) actor->add_int_xvel( (*moveptr - actor->int_xvel()) >> 1);
if (a & getv) actor->add_int_zvel( ((*(moveptr + 1) << 4) - actor->int_zvel()) >> 1);
if (a & geth) actor->vel.X += (moveptr[0] / 16 - actor->vel.X) * 0.5;
if (a & getv) actor->vel.Z += (moveptr[1] / 16 - actor->vel.Z) * 0.5;
if (a & dodgebullet)
dodge(actor);
@ -3615,7 +3615,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (actor->spr.picnum != APLAYER)
alterang(a, actor, pnum);
if (actor->int_xvel() > -6 && actor->int_xvel() < 6) actor->vel.X = 0;
if (abs(actor->vel.X) < 6 / 16.) actor->vel.X = 0;
a = badguy(actor);

View file

@ -68,7 +68,8 @@ int hulkspawn; // Spawn a hulk?
int lastlevel; // Set at the end of RRRA's E2L7.
short fakebubba_spawn, mamaspawn_count, banjosound; // RRRA special effects
short BellTime;
int WindTime, WindDir;
int WindTime;
DAngle WindDir;
uint8_t enemysizecheat /*raat607*/, ufospawnsminion, pistonsound, chickenphase /* raat605*/, RRRA_ExitedLevel, fogactive;
//-------------------------------------------------------------------------

View file

@ -124,7 +124,8 @@ extern short ambienthitag[64];
extern unsigned ambientfx;
extern TArray<DVector2> mspos;
extern TArray<CraneDef> cranes;
extern int WindTime, WindDir;
extern int WindTime;
extern DAngle WindDir;
extern short fakebubba_spawn, mamaspawn_count, banjosound;
extern short BellTime;
extern uint8_t enemysizecheat /*raat607*/, ufospawnsminion, pistonsound, chickenphase /* raat605*/, RRRA_ExitedLevel, fogactive;

View file

@ -247,7 +247,7 @@ inline ESpriteFlags randomXFlip()
return CSTAT_SPRITE_XFLIP;
}
inline DAngle randomAngle(double span)
inline DAngle randomAngle(double span = 360.)
{
return DAngle::fromDeg(krandf(span));
}

View file

@ -1239,7 +1239,7 @@ int doincrements_r(player_struct* p)
else if ((krand() & 127) == 8)
{
WindTime = 120 + ((krand() & 63) << 2);
WindDir = krand() & 2047;
WindDir = randomAngle();
}
if (BellTime > 0)

View file

@ -459,7 +459,7 @@ void resetprestat(int snum,int g)
earthquaketime = 0;
WindTime = 0;
WindDir = 0;
WindDir = nullAngle;
fakebubba_spawn = 0;
RRRA_ExitedLevel = 0;
BellTime = 0;
@ -697,7 +697,7 @@ void prelevel_common(int g)
thunderon = 0;
chickenplant = 0;
WindTime = 0;
WindDir = 0;
WindDir = nullAngle;
fakebubba_spawn = 0;
RRRA_ExitedLevel = 0;
mamaspawn_count = currentLevel->rr_mamaspawn;