mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-01 05:20:43 +00:00
- floatify all 3 operateweapon functions.
This commit is contained in:
parent
eae2e638aa
commit
9a4c699f53
4 changed files with 38 additions and 39 deletions
|
@ -173,11 +173,6 @@ void getglobalz(DDukeActor* s);
|
|||
void OnEvent(int id, int pnum = -1, DDukeActor* snum = nullptr, int dist = -1);
|
||||
|
||||
DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, int8_t s_shd, int8_t s_xr, int8_t s_yr, DAngle s_ang, double s_vel, double s_zvel, DDukeActor* s_ow, int8_t s_stat);
|
||||
[[deprecated]]
|
||||
inline DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, int8_t s_shd, int8_t s_xr, int8_t s_yr, int s_ang, int s_vel, int s_zvel, DDukeActor* s_ow, int8_t s_stat)
|
||||
{
|
||||
return CreateActor(whatsectp, pos, s_pn, s_shd, s_xr, s_yr, DAngle::fromBuild(s_ang), s_vel * inttoworld, s_zvel * zinttoworld, s_ow, s_stat);
|
||||
}
|
||||
|
||||
void ceilingglass(DDukeActor* snum, sectortype* sectnum, int cnt);
|
||||
void spriteglass(DDukeActor* snum, int cnt);
|
||||
|
|
|
@ -2215,7 +2215,6 @@ static void operateweapon(int snum, ESyncBits actions)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
auto pact = p->GetActor();
|
||||
int zvel, vel;
|
||||
|
||||
// already firing...
|
||||
|
||||
|
@ -2230,28 +2229,30 @@ static void operateweapon(int snum, ESyncBits actions)
|
|||
p->kickback_pic++;
|
||||
if (p->kickback_pic == 12)
|
||||
{
|
||||
double zvel, vel;
|
||||
|
||||
p->ammo_amount[HANDBOMB_WEAPON]--;
|
||||
|
||||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
vel = 15/16.;
|
||||
zvel = MulScale(p->horizon.sum().asq16(), 20, 16);
|
||||
zvel = p->horizon.sum().asbuildf() * (20 / 256.);
|
||||
}
|
||||
else
|
||||
{
|
||||
vel = 140/16.;
|
||||
zvel = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
|
||||
zvel = -4 - p->horizon.sum().asbuildf() * (20 / 256.);
|
||||
}
|
||||
|
||||
auto spawned = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, 9, 9,
|
||||
p->angle.ang.Buildang(), (vel + (p->hbomb_hold_delay << 5)), zvel, pact, 1);
|
||||
p->angle.ang, vel + p->hbomb_hold_delay * 2, zvel, pact, 1);
|
||||
|
||||
if (isNam())
|
||||
{
|
||||
spawned->spr.extra = MulScale(krand(), NAM_GRENADE_LIFETIME_VAR, 14);
|
||||
}
|
||||
|
||||
if (vel == 15)
|
||||
if (vel == 15 / 16.)
|
||||
{
|
||||
spawned->spr.yint = 3;
|
||||
spawned->spr.pos.Z += 8;
|
||||
|
|
|
@ -2691,7 +2691,6 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
auto pact = p->GetActor();
|
||||
int i, k;
|
||||
int psectlotag = psectp ? psectp->lotag : 857;
|
||||
|
||||
if (!isRRRA() && p->curr_weapon >= MOTORCYCLE_WEAPON) return;
|
||||
|
@ -2735,26 +2734,29 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
|
|||
}
|
||||
if (p->kickback_pic == 12)
|
||||
{
|
||||
double vel, zvel;
|
||||
|
||||
p->ammo_amount[DYNAMITE_WEAPON]--;
|
||||
if (p->ammo_amount[CROSSBOW_WEAPON])
|
||||
p->ammo_amount[CROSSBOW_WEAPON]--;
|
||||
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
|
||||
|
||||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
k = 15;
|
||||
i = -MulScale(p->horizon.sum().asq16(), 20, 16);
|
||||
vel = 15 / 16.;
|
||||
zvel = p->horizon.sum().asbuildf() * (20 / 256.);
|
||||
}
|
||||
else
|
||||
{
|
||||
k = 140;
|
||||
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
|
||||
vel = 140 / 16.;
|
||||
zvel = -4 - p->horizon.sum().asbuildf() * (20 / 256.);
|
||||
}
|
||||
|
||||
auto spawned = CreateActor(p->cursector,p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, 9, 9,
|
||||
p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pact, 1);
|
||||
auto spawned = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, 9, 9,
|
||||
p->angle.ang, vel + p->hbomb_hold_delay * 2, zvel, pact, 1);
|
||||
|
||||
if (spawned)
|
||||
{
|
||||
if (k == 15)
|
||||
if (vel == 15 / 16.)
|
||||
{
|
||||
spawned->spr.yint = 3;
|
||||
spawned->spr.pos.Z += 8;
|
||||
|
@ -3142,21 +3144,21 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
|
|||
case POWDERKEG_WEAPON:
|
||||
if (p->kickback_pic == 3)
|
||||
{
|
||||
double vel, zvel;
|
||||
p->ammo_amount[POWDERKEG_WEAPON]--;
|
||||
p->gotweapon[POWDERKEG_WEAPON] = false;
|
||||
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
|
||||
{
|
||||
k = 15;
|
||||
i = MulScale(p->horizon.sum().asq16(), 20, 16);
|
||||
vel = 15 / 16.;
|
||||
zvel = p->horizon.sum().asbuildf() * (20 / 256.);
|
||||
}
|
||||
else
|
||||
{
|
||||
k = 32;
|
||||
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
|
||||
vel = 2.;
|
||||
zvel = -4 - p->horizon.sum().asbuildf() * (20 / 256.);
|
||||
}
|
||||
|
||||
CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, POWDERKEG, -16, 9, 9,
|
||||
p->angle.ang.Buildang(), k * 2, i, pact, 1);
|
||||
CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, POWDERKEG, -16, 9, 9, p->angle.ang, vel * 2, zvel, pact, 1);
|
||||
}
|
||||
p->kickback_pic++;
|
||||
if (p->kickback_pic > 20)
|
||||
|
|
|
@ -310,7 +310,6 @@ void operateweapon_ww(int snum, ESyncBits actions)
|
|||
{
|
||||
auto p = &ps[snum];
|
||||
auto pact = p->GetActor();
|
||||
int i, k;
|
||||
|
||||
// already firing...
|
||||
if (aplWeaponWorksLike(p->curr_weapon, snum) == HANDBOMB_WEAPON)
|
||||
|
@ -327,44 +326,46 @@ void operateweapon_ww(int snum, ESyncBits actions)
|
|||
p->kickback_pic++;
|
||||
if (p->kickback_pic == aplWeaponHoldDelay(p->curr_weapon, snum))
|
||||
{
|
||||
double zvel, vel;
|
||||
|
||||
p->ammo_amount[p->curr_weapon]--;
|
||||
|
||||
if (p->on_ground && (actions & SB_CROUCH))
|
||||
{
|
||||
k = 15;
|
||||
i = MulScale(p->horizon.sum().asq16(), 20, 16);
|
||||
vel = 15 / 16.;
|
||||
zvel = p->horizon.sum().asbuildf() * (20 / 256.);
|
||||
}
|
||||
else
|
||||
{
|
||||
k = 140;
|
||||
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
|
||||
vel = 140 / 16.;
|
||||
zvel = -4 - p->horizon.sum().asbuildf() * (20 / 256.);
|
||||
}
|
||||
|
||||
auto j = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, 9, 9,
|
||||
p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)), i, p->GetActor(), 1);
|
||||
auto spawned = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, 9, 9,
|
||||
p->angle.ang, vel + p->hbomb_hold_delay * 2, zvel, pact, 1);
|
||||
|
||||
if (j)
|
||||
if (spawned)
|
||||
{
|
||||
{
|
||||
int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, snum).value();
|
||||
int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, snum).value();
|
||||
// set timer. blows up when at zero....
|
||||
j->spr.extra = lGrenadeLifetime
|
||||
spawned->spr.extra = lGrenadeLifetime
|
||||
+ MulScale(krand(), lGrenadeLifetimeVar, 14)
|
||||
- lGrenadeLifetimeVar;
|
||||
}
|
||||
|
||||
if (k == 15)
|
||||
if (vel == 15 / 16.)
|
||||
{
|
||||
j->spr.yint = 3;
|
||||
j->spr.pos.Z += 8;
|
||||
spawned->spr.yint = 3;
|
||||
spawned->spr.pos.Z += 8;
|
||||
}
|
||||
|
||||
int hd = hits(p->GetActor());
|
||||
if (hd < 32)
|
||||
{
|
||||
j->spr.angle += DAngle180;
|
||||
j->vel *= 1./3.;
|
||||
spawned->spr.angle += DAngle180;
|
||||
spawned->vel *= 1./3.;
|
||||
}
|
||||
|
||||
p->hbomb_on = 1;
|
||||
|
|
Loading…
Reference in a new issue